dns: fix segfault when resolver uses both ipv4 and ipv6 nameservers

This commit is contained in:
Michal Sekletar 2013-06-06 19:02:59 +02:00
parent 38276680e8
commit 401c0e5a53
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,30 @@
diff -up mtr-0.84/dns.c.mixed mtr-0.84/dns.c
--- mtr-0.84/dns.c.mixed 2013-06-06 18:56:19.360247890 +0200
+++ mtr-0.84/dns.c 2013-06-06 18:58:09.804233105 +0200
@@ -938,6 +938,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));
@@ -1336,6 +1338,8 @@ void dns_ack6(void)
if ( addrcmp( (void *) &(from6->sin6_addr), (void *) &localhost6,
(int) AF_INET6 ) == 0 ) {
for (i = 0;i < NSCOUNT6;i++) {
+ if (!NSSOCKADDR6(i))
+ continue;
if ( addrcmp( (void *) &(NSSOCKADDR6(i)->sin6_addr),
(void *) &(from6->sin6_addr), (int) AF_INET6 ) == 0 ||
addrcmp( (void *) &(NSSOCKADDR6(i)->sin6_addr),
@@ -1344,6 +1348,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;

View File

@ -1,7 +1,7 @@
Summary: A network diagnostic tool
Name: mtr
Version: 0.84
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 2
Group: Applications/Internet
License: GPLv2+
@ -13,6 +13,7 @@ Source3: net-x%{name}.desktop
Patch1: mtr-crash-in-xml-mode.patch
Patch2: mtr-xml-format-fixes.patch
Patch3: mtr-mixed-ipv4-ipv6-nameservers.patch
BuildRequires: ncurses-devel gtk2-devel desktop-file-utils
BuildRequires: autoconf automake libtool
@ -38,6 +39,7 @@ diagnostic tool.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%configure --enable-gtk2
@ -91,6 +93,9 @@ desktop-file-install \
%{_datadir}/pixmaps/mtr_icon.xpm
%changelog
* Thu Jun 06 2013 Michal Sekletar <msekleta@redhat.com> - 2:0.84-2
- fix crash when dns resolver is configured with both IPv4 and IPv6 nameservers
* Wed Apr 03 2013 Michal Sekletar <msekleta@redhat.com> - 2:0.84-1
- update to the newest upstream release
- specfile cleanup