Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ypbind avoid 64bit alignment issue with SIOCGIFCONF...



details:   https://anonhg.NetBSD.org/src/rev/b1e03d163458
branches:  trunk
changeset: 482730:b1e03d163458
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Feb 20 14:31:28 2000 +0000

description:
avoid 64bit alignment issue with SIOCGIFCONF (packed struct access).
From: =?iso-8859-1?Q?G=F6ran_Bengtson?= <goeran%cdg.chalmers.se@localhost>

diffstat:

 usr.sbin/ypbind/ypbind.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 80ea858d5a1f -r b1e03d163458 usr.sbin/ypbind/ypbind.c
--- a/usr.sbin/ypbind/ypbind.c  Sun Feb 20 13:32:52 2000 +0000
+++ b/usr.sbin/ypbind/ypbind.c  Sun Feb 20 14:31:28 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypbind.c,v 1.40 1999/08/16 03:12:32 simonb Exp $       */
+/*     $NetBSD: ypbind.c,v 1.41 2000/02/20 14:31:28 itojun Exp $       */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef LINT
-__RCSID("$NetBSD: ypbind.c,v 1.40 1999/08/16 03:12:32 simonb Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.41 2000/02/20 14:31:28 itojun Exp $");
 #endif
 
 #include <sys/param.h>
@@ -865,12 +865,12 @@
        ifr = ifc.ifc_req;
        ifreq.ifr_name[0] = '\0';
        for (i = 0; i < ifc.ifc_len; i += len, ifr = (struct ifreq *)((caddr_t)ifr + len)) {
+               memcpy(&ifreq, ifr, sizeof(ifreq));
 #if defined(BSD) && BSD >= 199103
-               len = sizeof ifr->ifr_name + ifr->ifr_addr.sa_len;
+               len = sizeof ifreq.ifr_name + ifreq.ifr_addr.sa_len;
 #else
                len = sizeof ifc.ifc_len / sizeof(struct ifreq);
 #endif
-               ifreq = *ifr;
                if (ifreq.ifr_addr.sa_family != AF_INET)
                        continue;
                if (ioctl(sock, SIOCGIFFLAGS, &ifreq) < 0) {



Home | Main Index | Thread Index | Old Index