]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: log: set proper smp size for balance log-hash
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 11:01:34 +0000 (12:01 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 14:38:41 +0000 (15:38 +0100)
commit94a9b0f5deabd49020c8ff535a3404494345b399
treec34b1023e649485b61f0171111e0c80f90cc039b
parentddf66132f4d77e00c52c977d8a9e5c829965e7c7
BUG/MINOR: log: set proper smp size for balance log-hash

result.data.u.str.size was set to size+1 to take into account terminating
NULL byte as per the comment. But this is wrong because the caller is free
to set size to just the right amount of bytes (without terminating NULL
byte). In fact all smp API functions will not read past str.data so there
is not risk about uninitialized reads, but this leaves an ambiguity for
converters that may use all the smp size to perform transformations, and
since we don't know about the "message" memory origin, we cannot assume
that its size may be greater than size. So we max it out to size just to
be safe.

This bug was not known to cause any issue, it was spotted during code
review. It should be backported in 2.9 with b30bd7a ("MEDIUM: log/balance:
support for the "hash" lb algorithm")
src/log.c