From 5f85395a780cbe43daa287156a133e2af65b5a55 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 16 Sep 2009 21:26:22 +0000 Subject: Fix off by one error in line parsing --- module/bsnmp-regex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/bsnmp-regex.c') diff --git a/module/bsnmp-regex.c b/module/bsnmp-regex.c index d30679b..ffc22c1 100644 --- a/module/bsnmp-regex.c +++ b/module/bsnmp-regex.c @@ -484,15 +484,15 @@ io_data (int fd, void *user_data) for (;;) { t = strchr (line_buffer, '\n'); if (t == NULL) { - /* Break really long lines */ - if (len >= LINE_LENGTH - 1) - t = line_buffer + len; - else + /* Wait for more data */ + if (len < LINE_LENGTH - 1) break; + /* Break really long lines */ + n = t = line_buffer + len; + } else { + n = t + 1; } - n = t + 1; - /* Break line (also DOS line) */ *t = 0; if (line_buffer != t && *(t - 1) == '\r') -- cgit v1.2.3