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 92149f9a82a9b55c598f1cc815bc330c555f3561 which is in
2.4+. The fix must be backported there.
---
src/tools.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tools.c b/src/tools.c
index 9e629e5bd..b9a1121c6 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -1374,7 +1374,7 @@ char * sa2str(const struct sockaddr_storage *addr, int
port, int map_ports)
default:
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)
return memprintf(, "%s:%+d", buffer, port);
else
--
2.36.1