CLEANUP: tools: Crash if inet_ntop fails due to ENOSPC in sa2str

This is impossible, because we pass a destination buffer that is appropriately
sized to hold an IPv6 address.

This is related to GitHub issue #1599.
This commit is contained in:
Tim Duesterhus 2022-05-23 09:30:49 +02:00 committed by Willy Tarreau
parent 162f0875ad
commit 22535a56a7

View File

@ -1375,7 +1375,10 @@ char * sa2str(const struct sockaddr_storage *addr, int port, int map_ports)
default:
return NULL;
}
inet_ntop(addr->ss_family, ptr, buffer, sizeof(buffer));
if (inet_ntop(addr->ss_family, ptr, buffer, sizeof(buffer)) == NULL) {
BUG_ON(errno == ENOSPC);
return NULL;
}
if (map_ports)
return memprintf(&out, "%s:%+d", buffer, port);
else