Date: Tue, 8 Mar 2011 02:04:57 GMT From: HIROSHI OOTA <nil@mad.dog.cx> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/155370: description string is broken Message-ID: <201103080204.p2824vH1006846@red.freebsd.org> Resent-Message-ID: <201103080210.p282A1k8058721@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 155370 >Category: misc >Synopsis: description string is broken >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: Tue Mar 08 02:10:01 UTC 2011 >Closed-Date: >Last-Modified: >Originator: HIROSHI OOTA >Release: 9-current >Organization: >Environment: FreeBSD xxxx 9.0-CURRENT FreeBSD 9.0-CURRENT #130 r219237: Fri Mar 4 03:45:57 JST 2011 root@ amd64 >Description: a description string which is returned from pcap_findalldevs(3) is broken. >How-To-Repeat: tcpdump -D >Fix: Patch attached with submission follows: Index: contrib/libpcap/inet.c =================================================================== --- contrib/libpcap/inet.c (revision 219237) +++ contrib/libpcap/inet.c (working copy) @@ -432,9 +432,11 @@ s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { for (;;) { - free(description); + if (description) + free(description); if ((description = malloc(descrlen)) != NULL) { #ifdef __FreeBSD__ + description[0] = 0; ifrdesc.ifr_buffer.buffer = description; ifrdesc.ifr_buffer.length = descrlen; #else /* __FreeBSD__ */ @@ -467,7 +469,8 @@ */ return (-1); } - free(description); + if (description) + free(description); if (curdev == NULL) { /* * Device wasn't added because it can't be opened. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103080204.p2824vH1006846>