]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-decode-mime: fix IsIpv6Host function
authorEric Leblond <eric@regit.org>
Wed, 23 Sep 2015 12:47:40 +0000 (14:47 +0200)
committerEric Leblond <eric@regit.org>
Tue, 6 Oct 2015 21:30:46 +0000 (23:30 +0200)
Using in6_addr is better when calling inet_pton. This fixes an
issue reported by ASAN.

src/util-decode-mime.c

index 292da4a0958bdb696f47d826d0ea929454c8e21f..38850c78af1e2d48f8d4a0680639cfa9e9b963c6 100644 (file)
@@ -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);
 }
 
 /**