tcpdump mailing list archives
suspisious getname() patch
From: "Gisle Vanem" <giva () bgnett no>
Date: Thu, 11 Mar 2004 17:53:15 +0100
This patch in getname() seems wrong:
+ if(!TTEST2(*ap, sizeof(addr))) {
+ return NULL;
+ }
+
getname() isn't always used on data from the capture, so the
above would return NULL for no good reason. E.g. in print-bpg.c
snprintf(buf, buflen, "%s/%d", getname((u_char *)&addr), plen);
&addr is not in the captured data.
Should we maybe add an extra argument to getname()?
Something like:
const char *getname(const u_char *ap, int from_capture)
{
...
if(from_capture && !TTEST2(*ap, sizeof(addr))) {
return NULL;
}
...
#define ipaddr_string(p) getname((const u_char *)(p), 1)
Briefly browsing through the code, it seems ipaddr_string() is
only used on captured data. But we could assert() that it really does.
--gv
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- suspisious getname() patch Gisle Vanem (Mar 11)
- Re: suspisious getname() patch Guy Harris (Mar 11)
