Don't assume we successfully read the configuration files.

read_configuration_files() can fail and return NULL, so check that
commandline_info.prefs_p is non-null before dereferencing it.

Fixes CID 1362778.

Change-Id: I3066769c474d394fbfe548b50d6be704964e59d3
Reviewed-on: https://code.wireshark.org/review/16028
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-06-19 15:28:39 -07:00
parent 30919f7708
commit fb9a7d43cd
1 changed files with 3 additions and 1 deletions

View File

@ -2497,7 +2497,9 @@ main(int argc, char *argv[])
#ifdef HAVE_LIBPCAP
if ((global_capture_opts.num_selected == 0) &&
((prefs.capture_device != NULL) && (*commandline_info.prefs_p->capture_device != '\0'))) {
((prefs.capture_device != NULL) &&
(commandline_info.prefs_p != NULL) &&
(*commandline_info.prefs_p->capture_device != '\0'))) {
guint i;
interface_t device;
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {