diff options
author | archie <archie@FreeBSD.org> | 1999-06-05 05:55:07 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 1999-06-05 05:55:07 +0000 |
commit | 9cf3e817878a26fda221f78495625164f5fd020c (patch) | |
tree | 1354d71e88ec43727765e6112f1b550962ed43dc /sbin/route | |
parent | d7f89ddca7bda593e462c757e7236f7be265b7ba (diff) | |
download | FreeBSD-src-9cf3e817878a26fda221f78495625164f5fd020c.zip FreeBSD-src-9cf3e817878a26fda221f78495625164f5fd020c.tar.gz |
When incrementing through a SIOCGIFCONF list, enforce a lower limit of
sizeof(ifr->ifr_addr) for the variable length field ifr->ifr_addr.sa_len.
Otherwise the increment will be wrong in certain cases.
Obtained from: Whistle source tree
For the record: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> suggests
SIOCGIFCONF should be dropped in favor of a sysctl mechanism.
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/route.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 45261b0..96dc90c 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #endif static const char rcsid[] = - "$Id: route.c,v 1.29 1998/07/28 06:25:35 charnier Exp $"; + "$Id: route.c,v 1.30 1999/06/01 13:14:07 ru Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -794,7 +794,8 @@ getaddr(which, s, hpp) (ifconf.ifc_buf + ifconf.ifc_len); ifr < ifr_end; ifr = (struct ifreq *) ((char *) &ifr->ifr_addr - + ifr->ifr_addr.sa_len)) { + + MAX(ifr->ifr_addr.sa_len, + sizeof(ifr->ifr_addr)))) { dl = (struct sockaddr_dl *)&ifr->ifr_addr; if (ifr->ifr_addr.sa_family == AF_LINK && (ifr->ifr_flags & IFF_POINTOPOINT) |