When searching for uninitialized memory usage add ensure that the entire

struct is set to zero.

PR:		bin/166483
Submitted by:	Roy Marples <roy@marples.name>
Reviewed by:	delphij
Approved by:	cperciva
MFC after:	3 days
This commit is contained in:
Eitan Adler 2012-04-15 23:56:03 +00:00
parent 468d6f48b3
commit e44d947d5a

View File

@ -70,6 +70,9 @@ if_nametoindex(const char *ifname)
s = _socket(AF_INET, SOCK_DGRAM, 0);
if (s != -1) {
#ifdef PURIFY
memset(&ifr, 0, sizeof(ifr));
#endif
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) {
_close(s);