From: Eric Leblond Date: Wed, 23 Sep 2015 12:47:40 +0000 (+0200) Subject: util-decode-mime: fix IsIpv6Host function X-Git-Tag: suricata-3.0RC1~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbb3e1976e417c3b1346e17b747f2ebd41328328;p=thirdparty%2Fsuricata.git util-decode-mime: fix IsIpv6Host function Using in6_addr is better when calling inet_pton. This fixes an issue reported by ASAN. --- 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); } /**