NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/41326: libpcap error message not printing useful information



>Number:         41326
>Category:       lib
>Synopsis:       libpcap error message not printing useful information
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 01 21:15:00 +0000 2009
>Originator:     Markus Mayer
>Release:        HEAD
>Organization:
Ericsson / Redback
>Environment:
>Description:
In two cases, libpcap will say that link-layer type "linktype" is not 
supported. However, "linktype" is always -1 at this point. Therefore, the error 
message will always complain about link-layer type -1 being unsupported.

It would be more helpful if "p->linktype" were being used instead of "linktype" 
in these two snprintf() calls.

>How-To-Repeat:

>Fix:
Index: savefile.c
===================================================================
RCS file: /cvsroot/src/dist/libpcap/savefile.c,v
retrieving revision 1.2
diff -u -r1.2 savefile.c
--- savefile.c  27 Feb 2006 15:55:30 -0000      1.2
+++ savefile.c  1 May 2009 21:12:39 -0000
@@ -1220,7 +1220,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: link-layer type %d isn't supported in savefiles",
-                   fname, linktype);
+                   fname, p->linktype);
                return (NULL);
        }

@@ -1254,7 +1254,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "stream: link-layer type %d isn't supported in savefiles",
-                   linktype);
+                   p->linktype);
                return (NULL);
        }




Home | Main Index | Thread Index | Old Index