summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.c b/util.c
index 2a9c7f4..f714863 100644
--- a/util.c
+++ b/util.c
@@ -88,6 +88,8 @@ char *addr2string(struct sockaddr *addr, socklen_t len) {
addr = (struct sockaddr *)&sa4;
}
}
+ len = addr->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
+
if (getnameinfo(addr, len, addr_buf[i], sizeof(addr_buf[i]),
NULL, 0, NI_NUMERICHOST)) {
debug(DBG_WARN, "getnameinfo failed");