BUG/MINOR: tools: url2sa reads ipv4 too far
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 18 Feb 2022 15:13:12 +0000 (16:13 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 18 Feb 2022 15:48:41 +0000 (16:48 +0100)
commit597e436053258d71e57381e14e1fae10220630bc
treefc6bb748a910b019188e01a75a3b456083fc2137
parente24da1b06a8a4824d7085f65502f020956201d2f
BUG/MINOR: tools: url2sa reads ipv4 too far

The url2sa implementation is inconsitent when parsing an IPv4, indeed
url2sa() takes a <ulen> as a parameter where the call to url2ipv4() takes
a null terminated string. Which means url2ipv4 could try to read more
that it is supposed to.

This function is only used from a buffer so it never reach a unallocated
space. It can only cause an issue when used from the httpclient which
uses it with an ist.

This patch fixes the issue by copying everything in the trash and
null-terminated it.

Must be backported in all supported version.

(cherry picked from commit 8a91374487e13cf139ab36e483163a21ebdc6f4e)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
src/tools.c