mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-16 15:44:04 +01:00
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.
This commit is contained in:
parent
2c7b227278
commit
3816c56cc1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47753
@ -45,7 +45,7 @@ static char const copyright[] =
|
||||
static char const sccsid[] = "@(#)from: arp.c 8.2 (Berkeley) 1/2/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: arp.c,v 1.14 1998/01/16 17:38:51 bde Exp $";
|
||||
"$Id: arp.c,v 1.15 1999/03/10 10:11:43 julian Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -696,8 +696,8 @@ get_ether_addr(u_long ipaddr, u_char *hwaddr)
|
||||
break;
|
||||
}
|
||||
nextif:
|
||||
ifr = (struct ifreq *)
|
||||
((char *)&ifr->ifr_addr + ifr->ifr_addr.sa_len);
|
||||
ifr = (struct ifreq *) ((char *)&ifr->ifr_addr
|
||||
+ MAX(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)));
|
||||
}
|
||||
|
||||
if (ifr >= ifend) {
|
||||
@ -725,8 +725,8 @@ nextif:
|
||||
printf("\n");
|
||||
return dla->sdl_alen;
|
||||
}
|
||||
ifr = (struct ifreq *)
|
||||
((char *)&ifr->ifr_addr + ifr->ifr_addr.sa_len);
|
||||
ifr = (struct ifreq *) ((char *)&ifr->ifr_addr
|
||||
+ MAX(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user