]> git.ozlabs.org Git - ppp.git/blobdiff - chat/chat.c
Fixing buffer overflow issue in chat.c
[ppp.git] / chat / chat.c
index 0740229163dd8ca54f2c1be2d23bcab6ffaad6e6..a5bfb9fe328d8886fc1c8288a696bf5c3409fbb6 100644 (file)
@@ -182,7 +182,7 @@ int n_aborts = 0, abort_next = 0, timeout_next = 0, echo_next = 0;
 int clear_abort_next = 0;
 
 char *report_string[MAX_REPORTS] ;
-char  report_buffer[256] ;
+char  report_buffer[4096] ;
 int n_reports = 0, report_next = 0, report_gathering = 0 ; 
 int clear_report_next = 0;
 
@@ -1419,8 +1419,10 @@ int get_string(register char *string)
        else {
            if (!iscntrl (c)) {
                int rep_len = strlen (report_buffer);
-               report_buffer[rep_len]     = c;
-               report_buffer[rep_len + 1] = '\0';
+               if ((rep_len + 1) < sizeof(report_buffer)) {
+                   report_buffer[rep_len]     = c;
+                   report_buffer[rep_len + 1] = '\0';
+               }
            }
            else {
                report_gathering = 0;