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 92149f9a82a9b55c598f1cc815bc330c555f3561 which is in
2.4+. The fix must be backported there.
diff --git a/src/tools.c b/src/tools.c
index 4c93e1e..79d1d5c 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -1375,7 +1375,7 @@
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(&out, "%s:%+d", buffer, port);
else