Date: Thu, 29 Mar 2012 08:53:54 GMT From: Roy Marples <roy@marples.name> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/166483: if_nametoindex sends un-initialized bytes to ioctl Message-ID: <201203290853.q2T8rsQc062455@red.freebsd.org> Resent-Message-ID: <201203290900.q2T90NoW029754@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 166483 >Category: bin >Synopsis: if_nametoindex sends un-initialized bytes to ioctl >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 29 09:00:22 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Roy Marples >Release: 7.1 >Organization: >Environment: [roy@uberlaptop /usr/home/roy]$ uname -a FreeBSD uberlaptop 7.1-RELEASE-p2 FreeBSD 7.1-RELEASE-p2 #3: Mon Feb 9 17:12:55 GMT 2009 root@uberlaptop:/usr/obj/usr/src/sys/GENERIC i386 >Description: if_nametoindex(3) sends un-initialized bytes to ioctl I found this when I was fixing BSD specific memory issues with dhcpcd. With the below patch to libc applied, dhcpcd-5.5.6 runs flawlessly without any errors reported by Valgrind. >How-To-Repeat: >Fix: Patch attached with submission follows: --- if_nametoindex.c.orig 2012-03-28 20:14:38.000000000 +0100 +++ if_nametoindex.c 2012-03-28 20:15:20.000000000 +0100 @@ -70,6 +70,7 @@ s = _socket(AF_INET, SOCK_DGRAM, 0); if (s != -1) { + memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) { _close(s); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203290853.q2T8rsQc062455>