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

Michal Sekletar msekleta at fedoraproject.org
Thu Jun 6 17:13:44 UTC 2013


commit 401c0e5a53e6ffe463cc0660becdf665d21e2702
Author: Michal Sekletar <msekleta at redhat.com>
Date:   Thu Jun 6 19:02:59 2013 +0200

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

 mtr-mixed-ipv4-ipv6-nameservers.patch |   30 ++++++++++++++++++++++++++++++
 mtr.spec                              |    7 ++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/mtr-mixed-ipv4-ipv6-nameservers.patch b/mtr-mixed-ipv4-ipv6-nameservers.patch
new file mode 100644
index 0000000..c43bd15
--- /dev/null
+++ b/mtr-mixed-ipv4-ipv6-nameservers.patch
@@ -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;
diff --git a/mtr.spec b/mtr.spec
index 69c04b3..c742d4c 100644
--- a/mtr.spec
+++ b/mtr.spec
@@ -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 at 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 at redhat.com> - 2:0.84-1
 - update to the newest upstream release
 - specfile cleanup


More information about the scm-commits mailing list