]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: log: reserve the trailing 0 in CBOR int and bool encoders
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 04:31:28 +0000 (04:31 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 12:05:25 +0000 (14:05 +0200)
commitcf9670997ad9ad018ad5e85bd1542e5c186ade7f
treef3562ccba8045d234a48b5e67a1cd7bfb15caae8
parent27219b2c0eccbae9f815bd62aa2e47d61708c08b
BUG/MEDIUM: log: reserve the trailing 0 in CBOR int and bool encoders

Commit 378386e14 ("BUG/MEDIUM: log: always reserve room for trailing 0 when
using CBOR encoding helpers") made the text encoding helpers reserve one
byte for the terminating NULL byte that sess_build_logline_orig() always
appends, but lf_bool_encode() and lf_int_encode() were missed:
_lf_cbor_encode_byte() and cbor_encode_int64_{bin,hex}() were still called
with "dst + size" as the stop pointer. So the trailing 0 could be written
one byte past the end of the output buffer.

Let's pass "dst + size - 1" to these encoders like the other helpers do.
The log_cbor reg-test was extended to sweep a string across the end of the
chunk, followed by an int or a bool, with pool tags enabled.

The was introduced by c614fd3b9 ("MINOR: log: add +cbor encoding
option"), so this must be backported up to 3.0.
reg-tests/log/log_cbor.vtc
src/log.c