summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/if_nametoindex.c
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-04-15 23:56:03 +0000
committereadler <eadler@FreeBSD.org>2012-04-15 23:56:03 +0000
commit5083bfbeba3e9731cb26dfabdf697d41ad2cfcd1 (patch)
treeabf74b98ea78fe997caf4b33c6dce511a4bf58aa /lib/libc/net/if_nametoindex.c
parent230291dbf193335d27e1ed8f421a9c227f5c0607 (diff)
downloadFreeBSD-src-5083bfbeba3e9731cb26dfabdf697d41ad2cfcd1.zip
FreeBSD-src-5083bfbeba3e9731cb26dfabdf697d41ad2cfcd1.tar.gz
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
Diffstat (limited to 'lib/libc/net/if_nametoindex.c')
-rw-r--r--lib/libc/net/if_nametoindex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c
index d0ca521..9d47089 100644
--- a/lib/libc/net/if_nametoindex.c
+++ b/lib/libc/net/if_nametoindex.c
@@ -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);
OpenPOWER on IntegriCloud