aboutsummaryrefslogtreecommitdiffstats
path: root/savefile.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@steve.local>2009-05-13 12:57:15 -0700
committerGuy Harris <gharris@steve.local>2009-05-13 12:57:15 -0700
commit6cbbcee6b675be5e63807767ff817ca6b75b7bee (patch)
tree15a4f6c30c33a55e635aef04596f541e36c87a6d /savefile.c
parent8cbe17bec228d1bcfcf4371f64361408b56ac4f3 (diff)
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.
Diffstat (limited to 'savefile.c')
-rw-r--r--savefile.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/savefile.c b/savefile.c
index 2ee8b9c..e69a84a 100644
--- a/savefile.c
+++ b/savefile.c
@@ -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,