dect
/
libpcap
Archived
13
0
Fork 0

Reject an attempt to pass an inactivated pcap_t to pcap_dump_open(), as

an inactivated pcap_t doesn't have a valid link-layer type or snapshot
length.
This commit is contained in:
Guy Harris 2009-05-13 12:57:15 -07:00
parent 8cbe17bec2
commit 6cbbcee6b6
1 changed files with 10 additions and 0 deletions

View File

@ -1734,6 +1734,16 @@ pcap_dump_open(pcap_t *p, const char *fname)
FILE *f;
int linktype;
/*
* If this pcap_t hasn't been activated, it doesn't have a
* link-layer type, so we can't use it.
*/
if (!p->activated) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"%s: not-yet-activated pcap_t passed to pcap_dump_open",
fname);
return (NULL);
}
linktype = dlt_to_linktype(p->linktype);
if (linktype == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,