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.
(cherry picked from commit b15f6dfae871f6ebfefa8a4e89958c1c70078e09)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 7b8ef8d23e34b2bb2bd2e91cfcf7b61125e9e09b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 1acf8c0e46fff90238467afe99a67511c9e98233)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit bb8b7630edf8cf5190c21baa13371b54a63aec6d)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
1 file changed