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:
parent
8cbe17bec2
commit
6cbbcee6b6
10
savefile.c
10
savefile.c
|
@ -1734,6 +1734,16 @@ pcap_dump_open(pcap_t *p, const char *fname)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int linktype;
|
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);
|
linktype = dlt_to_linktype(p->linktype);
|
||||||
if (linktype == -1) {
|
if (linktype == -1) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
|
Reference in New Issue