X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/c988f1f4faa9f679f79beddf3c14676c5dcb8e28..805e5aabc6e28e536153862bcef7268f84108fd7:/src/src/os.c diff --git a/src/src/os.c b/src/src/os.c index 7ca0fdabd..ce2154e39 100644 --- a/src/src/os.c +++ b/src/src/os.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/os.c,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/os.c,v 1.5 2006/02/07 11:19:00 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2006 */ /* See the file NOTICE for conditions of use and distribution. */ #ifdef STAND_ALONE @@ -661,8 +661,9 @@ for (cp = buf; cp < buf + ifc.V_ifc_len; cp += len) if ((ifreq.V_ifr_flags & IFF_UP) == 0) continue; /* On some operating systems we have to get the IP address of the interface - by another call. On others, it's already there, but we must reinstate the - data in ifreq, because SIOCGIFFLAGS may wreck it. */ + by another call. On others, it's already there, but we must copy the full + length because we only copied the basic length above, and anyway, + GIFFLAGS may have wrecked the data. */ #ifndef SIOCGIFCONF_GIVES_ADDR if (ioctl(vs, V_GIFADDR, (char *)&ifreq) < 0) @@ -671,8 +672,8 @@ for (cp = buf; cp < buf + ifc.V_ifc_len; cp += len) addrp = &ifreq.V_ifr_addr; #else - memcpy((char *)&ifreq, cp, sizeof(ifreq)); - memcpy(addrbuf, (char *)&(ifreq.V_ifr_addr), len - sizeof(ifreq.V_ifr_name)); + memcpy(addrbuf, cp + offsetof(struct V_ifreq, V_ifr_addr), + len - sizeof(ifreq.V_ifr_name)); addrp = (struct sockaddr *)addrbuf; #endif @@ -696,7 +697,7 @@ for (cp = buf; cp < buf + ifc.V_ifc_len; cp += len) /* Close the socket, and return the chain of data blocks. */ -close(vs); +(void)close(vs); return yield; }