]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: make memvprintf() never pass a NULL target to vsnprintf()
authorWilly Tarreau <w@1wt.eu>
Fri, 29 Mar 2019 18:13:23 +0000 (19:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Mar 2019 20:03:39 +0000 (21:03 +0100)
commite0609f5f49f55b122e7da9bd1d3b1b786366e80c
tree849ea0938d0db68d22f70e2ab3aac2d81005bc04
parent2231b638877aff9fc215377f9d6952630fb31d3c
MINOR: tools: make memvprintf() never pass a NULL target to vsnprintf()

Most modern platforms don't touch the output buffer when the size
argument is null, but there exist a few old ones (like AIX 5 and
possibly Tru64) where the output will be dereferenced anyway, probably
to write the trailing null, crashing the process. memprintf() uses this
to measure the desired length.

There is a very simple workaround to this consisting in passing a pointer
to a character instead of a NULL pointer. It was confirmed to fix the issue
on AIX 5.1.
src/standard.c