summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/bsnmp-regex.c13
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);