From: mutantmonkey Date: Sun, 21 Apr 2013 19:56:59 +0000 (-0400) Subject: Fix segfault with mixed IPv4/IPv6 nameservers X-Git-Tag: v0.85~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5%2Fhead;p=thirdparty%2Fmtr.git Fix segfault with mixed IPv4/IPv6 nameservers Fixes bug #1154432 --- diff --git a/dns.c b/dns.c index 683a4aa..8ea48ba 100644 --- a/dns.c +++ b/dns.c @@ -934,6 +934,8 @@ void dorequest(char *s,int type,word id) hp->id = id; /* htons() deliberately left out (redundant) */ #ifdef ENABLE_IPV6 for (i = 0;i < NSCOUNT6;i++) { + if (!NSSOCKADDR6(i)) + continue; if (NSSOCKADDR6(i)->sin6_family == AF_INET6) (void)sendto(resfd6,buf,r,0,(struct sockaddr *) NSSOCKADDR6(i), sizeof(struct sockaddr_in6)); @@ -1340,6 +1342,8 @@ void dns_ack6(void) } } else for (i = 0;i < NSCOUNT6;i++) { + if (!NSSOCKADDR6(i)) + continue; if ( addrcmp( (void *) &(NSSOCKADDR6(i)->sin6_addr), (void *) &(from6->sin6_addr), AF_INET6 ) == 0 ) break;