summaryrefslogtreecommitdiff
path: root/net/dnsmasq/patches/patch-ad
diff options
context:
space:
mode:
Diffstat (limited to 'net/dnsmasq/patches/patch-ad')
-rw-r--r--net/dnsmasq/patches/patch-ad36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/dnsmasq/patches/patch-ad b/net/dnsmasq/patches/patch-ad
new file mode 100644
index 00000000000..d920281c538
--- /dev/null
+++ b/net/dnsmasq/patches/patch-ad
@@ -0,0 +1,36 @@
+--- src/bpf.c 2008-11-18 14:01:26.000000000 +0000
++++ src/bpf.c 2008-11-18 14:09:21.000000000 +0000
+@@ -30,7 +30,7 @@
+
+ int iface_enumerate(void *parm, int (*ipv4_callback)(), int (*ipv6_callback)())
+ {
+- char *ptr;
++ char *ptr, *end;
+ struct ifreq *ifr;
+ struct ifconf ifc;
+ int fd, errsav, ret = 0;
+@@ -62,16 +62,20 @@
+ lastlen = ifc.ifc_len;
+ }
+ }
+-
+- for (ptr = ifc.ifc_buf; ptr < ifc.ifc_buf + ifc.ifc_len; ptr += len )
++
++ end = ifc.ifc_buf + ifc.ifc_len;
++ for (ptr = ifc.ifc_buf; ptr < end; ptr += len)
+ {
+ /* subsequent entries may not be aligned, so copy into
+ an aligned buffer to avoid nasty complaints about
+ unaligned accesses. */
+ #ifdef HAVE_SOCKADDR_SA_LEN
+- len = ((struct ifreq *)ptr)->ifr_addr.sa_len + offsetof(struct ifreq, ifr_ifru);
++ ifr = (struct ifreq *)ptr;
++ if (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_ifru))
++ len = ifr->ifr_addr.sa_len + offsetof(struct ifreq, ifr_ifru);
++ else
+ #else
+- len = sizeof(struct ifreq);
++ len = sizeof(struct ifreq);
+ #endif
+ if (!expand_buf(&ifreq, len))
+ goto err;