]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: chunks: always initialize the output chunk in get_trash_chunk()
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Dec 2013 16:32:08 +0000 (17:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 14 Dec 2013 15:02:18 +0000 (16:02 +0100)
commit031ad23c47dea81fd5980c4c6823884abd406515
treede00bf0324b0da39fbc7bec582ba3e8011c0cdb1
parent89efaed6b67b30739c39f0ff6dd2089632d3fda6
MINOR: chunks: always initialize the output chunk in get_trash_chunk()

The get_trash_chunk() function is convenient and is sometimes used even
to get a temporary string. While the chunk is initialized, the string
may contain some random garbage that some code might retrieve if it uses
chunk->str directly without checking ->len. This is what happened in checks
after commit 25e2ab5 (MEDIUM: checks: centralize error reporting). It's not
easy to guess it at first so better pre-initialize the string with a zero.
src/chunk.c