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:
parent
468d6f48b3
commit
e44d947d5a
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user