misc/155370: description string is broken
HIROSHI OOTA
nil at mad.dog.cx
Tue Mar 8 02:10:02 UTC 2011
>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:
More information about the freebsd-bugs
mailing list