inn-STABLE: innfeed: bug in hostDeleteIpv4Addr()

"Miquel van Smoorenburg" list-inn-workers at news.cistron.nl
Sat Apr 26 10:58:02 UTC 2008


There's a small bug in hostDeleteIpv4Addr(). After innfeed has
called that function, host->nextIpAddr can point outside the
host->ipAddrs[] array.

Okay, it's not so small :)

I did not notice it because for most of my IPv6 peers I had
bindaddress: none set. It doesn't happen when a peer only
has IPv6 addresses in host->ipAddrs[].

Here is the fix - it applies to inn-STABLE and it should
also be applied on top of the bindaddr-perpeer.patch I sent
for inn-CURRENT.

inn-STABLE-hostdeleteipv4addr-fix.patch

diff -ruN orig/inn-STABLE-20080421/innfeed/host.c inn-STABLE-20080421/innfeed/host.c
--- orig/inn-STABLE-20080421/innfeed/host.c	2008-04-21 11:08:28.000000000 +0200
+++ inn-STABLE-20080421/innfeed/host.c	2008-04-25 15:15:20.000000000 +0200
@@ -1277,10 +1277,10 @@
   for (i = 0, j = 0; host->ipAddrs[i]; i++) {
     if (host->ipAddrs[i]->sa_family != AF_INET)
       host->ipAddrs[j++] = host->ipAddrs[i];
-    if (i == host->nextIpAddr)
-      host->nextIpAddr -= (i - j);
   }
   host->ipAddrs[j] = 0;
+  if (host->nextIpAddr >= j)
+      host->nextIpAddr = 0;
 }
 #endif
 

Mike.
-- 
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Miquel van Smoorenburg" <miquels at cistron.nl>


More information about the inn-workers mailing list