diff options
author | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-03-01 23:46:05 +0000 |
---|---|---|
committer | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-03-01 23:46:05 +0000 |
commit | c555fb9966f2b9bd6bf08ec0fed5e37d877c3ab4 (patch) | |
tree | f5e651124d02ec33c619716a381886630be31b58 /tethereal.c | |
parent | 1c3f0a800b3c5efeba11a6d3ced46829b5624877 (diff) |
If -z was not given as the very last argument the tap listener initialization might have crashed.
Copy the optarg so that when the tap initialization is called it gets the right argument.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13570 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tethereal.c b/tethereal.c index e7b522ae51..3d05d1a386 100644 --- a/tethereal.c +++ b/tethereal.c @@ -682,7 +682,7 @@ main(int argc, char *argv[]) e_prefs *prefs; char badopt; ethereal_tap_list *tli = NULL; - gboolean got_tap = FALSE; + guint8* tli_optarg = NULL; #ifdef HAVE_LIBPCAP capture_opts_init(&capture_opts, NULL /* cfile */); @@ -1050,7 +1050,7 @@ main(int argc, char *argv[]) as it would disallow mate's fields (which are registered by the preferences set callback) from being used as part of a tap filter */ - got_tap = TRUE; + tli_optarg = g_strdup(optarg); break; } } @@ -1240,8 +1240,10 @@ main(int argc, char *argv[]) /* At this point mate will have registered its field array so we can have a filter with one of mate's late registered fields as part of the tap's filter */ - if (got_tap) - (*tli->func)(optarg); + if (tli_optarg != NULL) { + (*tli->func)(tli_optarg); + g_free(tli_optarg); + } /* disabled protocols as per configuration file */ if (gdp_path == NULL && dp_path == NULL) { |