From dbb3e1976e417c3b1346e17b747f2ebd41328328 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Wed, 23 Sep 2015 14:47:40 +0200 Subject: [PATCH] util-decode-mime: fix IsIpv6Host function Using in6_addr is better when calling inet_pton. This fixes an issue reported by ASAN. --- src/util-decode-mime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util-decode-mime.c b/src/util-decode-mime.c index 292da4a095..38850c78af 100644 --- a/src/util-decode-mime.c +++ b/src/util-decode-mime.c @@ -942,7 +942,7 @@ static int IsIpv4Host(const uint8_t *urlhost, uint32_t len) */ static int IsIpv6Host(const uint8_t *urlhost, uint32_t len) { - struct sockaddr_in sa; + struct in6_addr in6; char tempIp[MAX_IP6_CHARS + 1]; /* Cut off at '/' */ @@ -963,7 +963,7 @@ static int IsIpv6Host(const uint8_t *urlhost, uint32_t len) memcpy(tempIp, urlhost, i); tempIp[i] = '\0'; - return inet_pton(AF_INET6, tempIp, &(sa.sin_addr)); + return inet_pton(AF_INET6, tempIp, &in6); } /** -- 2.47.2