X11 buffer overflow avoidance
Don't overflow the buffer passed to getlin().
This commit is contained in:
+9
-1
@@ -1210,12 +1210,20 @@ done_button(w, client_data, call_data)
|
|||||||
XtPointer client_data;
|
XtPointer client_data;
|
||||||
XtPointer call_data;
|
XtPointer call_data;
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
char *s;
|
char *s;
|
||||||
Widget dialog = (Widget) client_data;
|
Widget dialog = (Widget) client_data;
|
||||||
|
|
||||||
s = (char *) GetDialogResponse(dialog);
|
s = (char *) GetDialogResponse(dialog);
|
||||||
Strcpy(getline_input, s);
|
len = strlen(s);
|
||||||
|
|
||||||
|
/* Truncate input if necessary */
|
||||||
|
if (len >= BUFSZ) len = BUFSZ - 1;
|
||||||
|
|
||||||
|
(void) strncpy(getline_input, s, len);
|
||||||
|
getline_input[len] = '\0';
|
||||||
XtFree(s);
|
XtFree(s);
|
||||||
|
|
||||||
nh_XtPopdown(XtParent(dialog));
|
nh_XtPopdown(XtParent(dialog));
|
||||||
exit_x_event = TRUE;
|
exit_x_event = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user