diff options
author | Stef Walter <stef@memberwebs.com> | 2007-05-24 23:22:10 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2007-05-24 23:22:10 +0000 |
commit | 7515c2cada4d2fe348fcf8917b4ee463988ef557 (patch) | |
tree | 55a2523e2a7519b8f1d97e7e2f642f4b40ef7b07 /module | |
parent | d42325a2687e2e48c433ea74848b6fe32c4c7283 (diff) |
Fix problem with an assert when lines were too long.
Diffstat (limited to 'module')
-rw-r--r-- | module/bsnmp-regex.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/module/bsnmp-regex.c b/module/bsnmp-regex.c index cfa8163..a859264 100644 --- a/module/bsnmp-regex.c +++ b/module/bsnmp-regex.c @@ -450,7 +450,7 @@ io_data (int fd, void *user_data) { struct connection *conn = (struct connection*)user_data; char *line_buffer; - char *t; + char *t, *n; int len; int r, l; @@ -491,19 +491,20 @@ io_data (int fd, void *user_data) break; } + n = t; + /* Break line (also DOS line) */ *t = 0; if (line_buffer != t && *(t - 1) == '\r') - *(t - 1) = 0; - l = (t + 1) - line_buffer; + *(--t) = 0; + l = t - line_buffer; /* Send it off */ process_log (line_buffer, l); /* Move data to front of buffer */ - ASSERT (l <= len); - memmove (line_buffer, t + 1, (len - l) + 1); - len -= l; + len -= (n - line_buffer); + memmove (line_buffer, n, len); } } while (r > 0); |