]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: logs: prevent double line returns in some events.
authorEmeric Brun <ebrun@haproxy.com>
Tue, 12 May 2020 17:33:15 +0000 (19:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 May 2020 08:59:53 +0000 (10:59 +0200)
commit9e8ea0ae6f63fe1a8119d99b1218ccc095b390ac
tree0511388c16c244f7576958de9105f40598346798
parent62f79fe68a87c66e44bc172959f03f810572e4fa
BUG/MINOR: logs: prevent double line returns in some events.

Historically some messages used to already contain the trailing LF but
not all, and __do_send_log adds a new one in needed cases. It also does
trim a trailing LF in certain cases while computing the max message
length, as a result of subtracting 1 to the available room in the
destination buffer. But the way it's done is wrong since some messages
still contain it.

So the code was fixed to always trim the trailing LF from messages if
present, and then only subtract 1 from the destination buffer room
instead of the size..

Note: new sink API is not designed to receive a trailing LF on
event messages

This could be backported to relevant stable versions with particular
care since the logic of the code changed a bit since 1.6 and there
may be other locations that need to be adjusted.
src/log.c