On Thu, Aug 29, 2013 at 10:50:09PM +0200, Lukas Tribus wrote: > The behavior also depends on the syslog facility; I used "syslog" in my tests. > > > With the current git tree I see the following behavior: > ntp and local7: syslog ends with \n <-- correct behavior! > ftp and user: syslog ends with \n + 2 random characters > kern: syslog ends with \n + 4 random characters > > It seems 2a4a44f0f9f caused the initial problem and bfb099c3b3f1 amplified it. > > > > Regards, > > Lukas
Hello Lukas, Thanks for your analyze, the bug was indeed caused by the number of digits in the facility. Here's a patch with the real size to send :) -- William Lallemand
>From fcf527a2c629b696e8e2fa2993feb5be90b9ef04 Mon Sep 17 00:00:00 2001 From: William Lallemand <wlallem...@exceliance.fr> Date: Fri, 30 Aug 2013 14:17:46 +0200 Subject: [PATCH] BUG/MINOR: log: junk at the end of syslog packet With a facily of 2 or 1 digit, the send size was wrong and bytes with unknown value were sent. The size was calculated using the start of the buffer and not the start of the data which varies with the number of digits of the facility. This bug was reported by Samuel Stoller and reported by Lukas Tribus. --- src/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index 369dc34..ad9fa73 100644 --- a/src/log.c +++ b/src/log.c @@ -847,7 +847,7 @@ void __send_log(struct proxy *p, int level, char *message, size_t size) } while (fac_level && log_ptr > dataptr); *log_ptr = '<'; - sent = sendto(*plogfd, log_ptr, size + log_ptr - dataptr, + sent = sendto(*plogfd, log_ptr, size - (log_ptr - dataptr), MSG_DONTWAIT | MSG_NOSIGNAL, (struct sockaddr *)&logsrv->addr, get_addr_len(&logsrv->addr)); if (sent < 0) { -- 1.8.1.5