]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: ist: allocate nul byte on istdup
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 21 Feb 2024 15:10:43 +0000 (16:10 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Feb 2024 17:24:35 +0000 (18:24 +0100)
commitde02167584606d02872e8f0918c882709bec6a80
tree2898f69d2f01ce91abf82f7cf892fdc6393ce0a3
parent2462e5bccab61fc8afd3d8fc6cf5617a47d1726a
BUG/MINOR: ist: allocate nul byte on istdup

istdup() is documented as having the same behavior as strdup(). However,
it may cause confusion as it allocates a block of input length, without
an extra byte for \0 delimiter. This behavior is incoherent as in case
of an empty string however a single \0 is allocated.

This API inconsistency could cause a bug anywhere an IST is used as a
C-string after istdup() invocation. Currently, the only found issue is
with 'wait' CLI command using 'srv-unused'. This causes a buffer
overflow due to ist0() invocation after istdup() for be_name and
sv_name.

Backport should be done to all stable releases. Even if no bug has been
found outside of wait CLI implementation, it ensures the code is more
consistent on every releases.
include/import/ist.h