]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: log: fix lf_text_len() truncate inconsistency
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 9 Apr 2024 09:15:23 +0000 (11:15 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 9 Apr 2024 15:30:13 +0000 (17:30 +0200)
commitb15f6dfae871f6ebfefa8a4e89958c1c70078e09
treeb307a0f9993a773265b1b5f4d12bebb336fd6ba3
parent0db8b6034d87abe33792b8ff69693c9ca3900d2f
BUG/MINOR: log: fix lf_text_len() truncate inconsistency

In c5bff8e550 ("BUG/MINOR: log: improper behavior when escaping log data")
we fixed lf_text_len() behavior with +E (escape) option.

However we introduced an inconsistency if output buffer is too small to
hold the whole output and truncation occurs: indeed without +E option up
to <size> bytes (including NULL byte) will be used whereas with +E option
only <size-1> bytes will be used. Fixing the function and related comment
so that the function behaves the same in regards to truncation whether +E
option is used or not.

This should be backported to all stable versions.
src/log.c