openbsd-ports/comms/conserver/patches/patch-conserver_cutil_c
sthen 29f3197b55 Update conserver to 8.1.16, which fixes some bugs, rolls in
pvalchev's strcpy->strlcpy diffs, and adds some new functionality
(see http://www.conserver.com/CHANGES for more details).
Our /etc/services now includes a definition for conserver,
so no need to mention it in the package installation message.

ok pvalchev (maintainer).
2008-06-21 11:29:25 +00:00

73 lines
2.2 KiB
Plaintext

$OpenBSD: patch-conserver_cutil_c,v 1.3 2008/06/21 11:29:25 sthen Exp $
--- conserver/cutil.c.orig Tue Dec 26 07:27:34 2006
+++ conserver/cutil.c Fri Oct 12 11:45:03 2007
@@ -2189,7 +2189,7 @@ ProbeInterfaces(bindAddr)
{
#ifdef SIOCGIFCONF
struct ifconf ifc;
- struct ifreq *ifr;
+ struct ifreq ifr;
#ifdef SIOCGIFFLAGS
struct ifreq ifrcopy;
#endif
@@ -2258,7 +2258,7 @@ ProbeInterfaces(bindAddr)
* than loop through looking for valid interfaces that are up
* twice, huh?
*/
- count = ifc.ifc_len / sizeof(*ifr);
+ count = ifc.ifc_len / sizeof(ifr);
CONDDEBUG((1, "ProbeInterfaces(): ifc_len==%d max_count==%d",
ifc.ifc_len, count));
@@ -2277,17 +2277,18 @@ ProbeInterfaces(bindAddr)
for (m = r = 0; r < ifc.ifc_len;) {
struct sockaddr *sa;
- ifr = (struct ifreq *)&ifc.ifc_buf[r];
- sa = (struct sockaddr *)&ifr->ifr_addr;
+
+ memcpy(&ifr, &ifc.ifc_buf[r], sizeof(ifr));
+ sa = (struct sockaddr *)&ifr.ifr_addr;
/* don't use less than a ifreq sized chunk */
- if ((ifc.ifc_len - r) < sizeof(*ifr))
+ if ((ifc.ifc_len - r) < sizeof(ifr))
break;
#ifdef HAVE_SA_LEN
- if (sa->sa_len > sizeof(ifr->ifr_addr))
- r += sizeof(ifr->ifr_name) + sa->sa_len;
+ if (sa->sa_len > sizeof(ifr.ifr_addr))
+ r += sizeof(ifr.ifr_name) + sa->sa_len;
else
#endif
- r += sizeof(*ifr);
+ r += sizeof(ifr);
if (sa->sa_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
@@ -2308,14 +2309,14 @@ ProbeInterfaces(bindAddr)
#ifdef SIOCGIFFLAGS
/* make sure the interface is up */
- ifrcopy = *ifr;
+ memcpy(&ifrcopy, &ifr, sizeof(ifrcopy));
if ((ioctl(sock, SIOCGIFFLAGS, &ifrcopy) == 0) &&
((ifrcopy.ifr_flags & IFF_UP) == 0))
continue;
#endif
CONDDEBUG((1, "ProbeInterfaces(): name=%s addr=%s",
- ifr->ifr_name, inet_ntoa(sin->sin_addr)));
+ ifr.ifr_name, inet_ntoa(sin->sin_addr)));
#if HAVE_MEMCPY
memcpy(&myAddrs[m], &(sin->sin_addr), sizeof(struct in_addr));
@@ -2324,7 +2325,7 @@ ProbeInterfaces(bindAddr)
#endif
Verbose("interface address %s (%s)", inet_ntoa(myAddrs[m]),
- ifr->ifr_name);
+ ifr.ifr_name);
m++;
}
}