From 008e9f17c1ce9433134a592e8179e4976185f68c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 23 Mar 2019 22:19:13 +0000 Subject: [PATCH] other: use IP string lengths from netinet/in.h Signed-off-by: Sami Kerola --- src/other.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/other.c b/src/other.c index f9df885..21a19f4 100644 --- a/src/other.c +++ b/src/other.c @@ -298,7 +298,7 @@ const char *ntop_ipaddr_init(const union ipaddr_t *ip __attribute__ ((unused))) const char *ntop_ipaddr_v4(const union ipaddr_t *ip) { - static char buffer[sizeof("255.255.255.255")]; + static char buffer[INET_ADDRSTRLEN]; struct in_addr addr; addr.s_addr = htonl(ip->v4); @@ -307,7 +307,7 @@ const char *ntop_ipaddr_v4(const union ipaddr_t *ip) const char *ntop_ipaddr_v6(const union ipaddr_t *ip) { - static char buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + static char buffer[INET6_ADDRSTRLEN]; struct in6_addr addr; memcpy(addr.s6_addr, ip->v6, sizeof(addr.s6_addr));