From 7515c2cada4d2fe348fcf8917b4ee463988ef557 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 24 May 2007 23:22:10 +0000 Subject: Fix problem with an assert when lines were too long. --- module/bsnmp-regex.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'module') 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); -- cgit v1.2.3