Subject: Re: pkg/33696: segfault in net/tinc
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Miles Nordin <carton@Ivy.NET>
List: pkgsrc-bugs
Date: 06/11/2006 20:50:02
The following reply was made to PR pkg/33696; it has been noted by GNATS.
From: Miles Nordin <carton@Ivy.NET>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/33696: segfault in net/tinc
Date: Sun, 11 Jun 2006 16:47:36 -0400
I think both these patches are needed---Guus (tinc maintainer
upstream) found another instance of the same problem. Guus has
checked something into tinc's subversion repository which might be
better to use, but I don't know how to use subversion. IMHO is better
to use these two patches than wait for the next tinc release, but you
could also just wait.
Index: distinfo
===================================================================
RCS file: /scratch/cvsroot/netbsd/pkgsrc/net/tinc/distinfo,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 distinfo
--- distinfo 18 Jul 2005 13:09:31 -0000 1.1.1.3
+++ distinfo 11 Jun 2006 20:12:19 -0000
@@ -4,3 +4,5 @@
RMD160 (tinc-1.0.4.tar.gz) = f4ec33a10f5039c625ec124376216cc03aa5f318
Size (tinc-1.0.4.tar.gz) = 480305 bytes
SHA1 (patch-aa) = c43fabf6e3b7a42f2817d36fff72f2c87747f890
+SHA1 (patch-ac) = 6d30e360f0612c1240a5ce15293d43d3684ebccd
+SHA1 (patch-ad) = 67fe4ca2aa3f9070c10d105b2c4b9977f40a5697
Index: patches/patch-ac
===================================================================
RCS file: patches/patch-ac
diff -N patches/patch-ac
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-ac 29 May 2006 04:05:49 -0000
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/netutl.c.orig
++++ src/netutl.c
+@@ -78,7 +78,7 @@
+ return result;
+ }
+
+- result = *(sockaddr_t *) ai->ai_addr;
++ memcpy(&result, (sockaddr_t *) ai->ai_addr, ai->ai_addr->sa_len);
+ freeaddrinfo(ai);
+
+ return result;
Index: patches/patch-ad
===================================================================
RCS file: patches/patch-ad
diff -N patches/patch-ad
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-ad 11 Jun 2006 20:12:15 -0000
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- src/net_setup.c.orig
++++ src/net_setup.c
+@@ -219,6 +219,7 @@
+ char *address = NULL;
+ char *envp[5];
+ struct addrinfo *ai, *aip, hint = {0};
++ sockaddr_t sa;
+ bool choice;
+ int i, err;
+
+@@ -486,25 +487,26 @@
+ listen_sockets = 0;
+
+ for(aip = ai; aip; aip = aip->ai_next) {
++ memcpy(&sa, (sockaddr_t *) aip->ai_addr, aip->ai_addr->sa_len);
+ listen_socket[listen_sockets].tcp =
+- setup_listen_socket((sockaddr_t *) aip->ai_addr);
++ setup_listen_socket((sockaddr_t *) &sa);
+
+ if(listen_socket[listen_sockets].tcp < 0)
+ continue;
+
+ listen_socket[listen_sockets].udp =
+- setup_vpn_in_socket((sockaddr_t *) aip->ai_addr);
++ setup_vpn_in_socket((sockaddr_t *) &sa);
+
+ if(listen_socket[listen_sockets].udp < 0)
+ continue;
+
+ ifdebug(CONNECTIONS) {
+- hostname = sockaddr2hostname((sockaddr_t *) aip->ai_addr);
++ hostname = sockaddr2hostname((sockaddr_t *) &sa);
+ logger(LOG_NOTICE, _("Listening on %s"), hostname);
+ free(hostname);
+ }
+
+- listen_socket[listen_sockets].sa.sa = *aip->ai_addr;
++ listen_socket[listen_sockets].sa = sa;
+ listen_sockets++;
+ }
+