BUG/MINOR: chunk: fix chunk_appendf() to not write a zero if buffer is full

If the buffer is completely full, the function chunk_appendf() would
write a zero past it, which can result in unexpected behavior.

Now we make a check before calling vsnprintf() and return the current
chunk size if no room is available.

This should be backported as far as 2.0.

(cherry picked from commit f7596209eea21ee4e62ea24c8bc18e181d13f348)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit aafbc3a1f5e7ba98e3b48060b905f9b32a8cb405)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit 360fce99489c4cca5d12209a35ea920dfa8ee185)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit a668fcd398d0d1ac12711dd460362ae0f3f02905)
Signed-off-by: Willy Tarreau <w@1wt.eu>
1 file changed