summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2009-09-16 21:26:22 +0000
committerStef Walter <stef@memberwebs.com>2009-09-16 21:26:22 +0000
commit5f85395a780cbe43daa287156a133e2af65b5a55 (patch)
treeb2b150b29db854905a6b1f97af37d004f1ba2bb3
parent5665604d7fcafd3d24877562dd36d60895c29cc6 (diff)
Fix off by one error in line parsing
-rw-r--r--ChangeLog3
-rw-r--r--module/bsnmp-regex.c12
2 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 63cf085..d65639d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+0.5:
+ * Fix line off by one error.
+
0.4:
* Add regexCounter variable for 64 bit values
* Fix assertion when selecting text at end of line
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')