Date: Sun, 15 Apr 2012 23:56:04 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234329 - head/lib/libc/net Message-ID: <201204152356.q3FNu4W4007224@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Sun Apr 15 23:56:03 2012 New Revision: 234329 URL: http://svn.freebsd.org/changeset/base/234329 Log: 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 Modified: head/lib/libc/net/if_nametoindex.c Modified: head/lib/libc/net/if_nametoindex.c ============================================================================== --- head/lib/libc/net/if_nametoindex.c Sun Apr 15 23:50:13 2012 (r234328) +++ head/lib/libc/net/if_nametoindex.c Sun Apr 15 23:56:03 2012 (r234329) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204152356.q3FNu4W4007224>