mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 16:17:09 +02:00
BUG/MEDIUM: tools: Fix inet_ntop
usage in sa2str
The given size must be the size of the destination buffer, not the size of the
(binary) address representation.
This fixes GitHub issue #1599.
The bug was introduced in 92149f9a82
which is in
2.4+. The fix must be backported there.
This commit is contained in:
parent
147eeb2ef3
commit
162f0875ad
@ -1375,7 +1375,7 @@ char * sa2str(const struct sockaddr_storage *addr, int port, int map_ports)
|
|||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
inet_ntop(addr->ss_family, ptr, buffer, get_addr_len(addr));
|
inet_ntop(addr->ss_family, ptr, buffer, sizeof(buffer));
|
||||||
if (map_ports)
|
if (map_ports)
|
||||||
return memprintf(&out, "%s:%+d", buffer, port);
|
return memprintf(&out, "%s:%+d", buffer, port);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user