BUG/MINOR: log: fixing bug in tcp syslog_io_handler Octet-Counting
syslog_io_handler does specific treatment to handle syslog tcp octet
counting:
Logic was good, but a sneaky mistake prevented
rfc-6587 octet counting from working properly.
trash.area was used as an input buffer.
It does not make sense here since it is uninitialized.
Compilation was unaffected because trash is a thread
local "global" variable.
buf->area should definitely be used instead.
This should be backported as far as 2.4.
(cherry picked from commit 7faffdc6abc662470a4706f6c5af7c9c3a8764fb)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 55f37aa5e5d337b3ce9c5479e40434b22e8999ec)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 3069c430f84954d4c90c15b433798d154d1a4955)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/log.c b/src/log.c
index 2637328..781f0af 100644
--- a/src/log.c
+++ b/src/log.c
@@ -3816,7 +3816,7 @@
if (buf->area[to_skip - 1] != ' ')
goto parse_error;
- msglen = strtol(trash.area, &p, 10);
+ msglen = strtol(buf->area, &p, 10);
if (!msglen || p != &buf->area[to_skip - 1])
goto parse_error;