summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9cb7ef)
raw | patch | inline | side by side (parent: f9cb7ef)
author | Florian Forster <octo@collectd.org> | |
Wed, 10 Sep 2014 14:54:26 +0000 (16:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 10 Sep 2014 14:54:26 +0000 (16:54 +0200) |
Because the length of the string was decremented too late, the function
would actually overwrite the trailing null byte instead of the newline.
would actually overwrite the trailing null byte instead of the newline.
src/common.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 9c4e64f68783d446073f3b21e8f46e8e219bff2c..b771f62ed651c898d97082cb1617a4ac8ec7b031 100644 (file)
--- a/src/common.c
+++ b/src/common.c
if ((buffer[buffer_len - 1] != '\n')
&& (buffer[buffer_len - 1] != '\r'))
break;
- buffer[buffer_len] = 0;
buffer_len--;
+ buffer[buffer_len] = 0;
}
return (buffer_len);