]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: logs: fix trailing zeros on log message.
authorEmeric Brun <ebrun@haproxy.com>
Thu, 28 May 2020 12:21:33 +0000 (14:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 May 2020 13:30:51 +0000 (15:30 +0200)
This patch removes all trailing LFs and Zeros from
log messages. Previously only the last LF was removed.

It's a regression from e8ea0ae6f6 "BUG/MINOR: logs:
prevent double line returns in some events."

This should fix github issue #654

src/log.c

index d69c94e04ef48efb45ecb65fd6231f94faad3f17..b4b00cfa14bd7b6c60097f4a355b66c112c0f0ae 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1579,8 +1579,10 @@ static inline void __do_send_log(struct logsrv *logsrv, int nblogger, char *pid_
 
        dataptr = message;
 
-       /* historically some messages used to already contain the trailing LF */
-       if (size && (dataptr[size-1] == '\n'))
+       /* historically some messages used to already contain the trailing LF
+        * or Zero. Let's remove all trailing LF or Zero
+        */
+       while (size && ((dataptr[size-1] == '\n' || (dataptr[size-1] == 0))))
                size--;
 
        if (logsrv->type == LOG_TARGET_FD) {