aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2012-02-21 15:21:01 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2012-02-21 15:21:01 +0000
commit7d7c5ca02d71e6e4bb5ed268268979d9c6e65e1d (patch)
tree3604f7199470f76b89c0813d930652194a5c1bd8 /wiretap/file_access.c
parente485ac5175ed520a90ef5bc7a127201d44309a2a (diff)
Don't dereference idb_inf in wtap_dump_open_ng() when
you provide NULL when you call it via wtap_dump_open. This does not make the buildbots happy, but at least tshark doesn't crash anymore. svn path=/trunk/; revision=41111
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r--wiretap/file_access.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index c600d65a37..3d32cc85b0 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -998,10 +998,15 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap,
/* Set Section Header Block data */
wdh->shb_hdr = shb_hdr;
/* Set Interface Description Block data */
- wdh->number_of_interfaces = idb_inf->number_of_interfaces;
- wdh->interface_data = idb_inf->interface_data;
- g_free(idb_inf);
-
+ if (idb_inf != NULL) {
+ wdh->number_of_interfaces = idb_inf->number_of_interfaces;
+ wdh->interface_data = idb_inf->interface_data;
+ g_free(idb_inf);
+ } else {
+ wdh->number_of_interfaces= 0;
+ wdh->interface_data= NULL;
+ }
+
/* "-" means stdout */
if (strcmp(filename, "-") == 0) {
if (compressed) {