aboutsummaryrefslogtreecommitdiffstats
path: root/epan/stat_tap_ui.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-10-05 12:33:13 +0200
committerAnders Broman <a.broman58@gmail.com>2018-10-05 13:19:32 +0000
commit7c890e3307aac34ecf394e67cec7a29d1f1e364d (patch)
tree79dace84ad3bc2ae306e1ec9ce2ec9f1e6a4035a /epan/stat_tap_ui.c
parent8dfaa8fa7c97cd1372a0a233b83fbc7945447b75 (diff)
Do not modify optarg with -zfollow,ssl,ascii,0
Most callers (in tshark.c, ui/commandline.c, etc.) do not modify their optarg argument, so don't do that here either. Fixes: v2.9.0rc0-2110-g872b573381 ("Recognize -zfollow, ssl, ascii, 0 for compatibility") Change-Id: I80d56aee7ba80591b684d847a9cc95cf9a96c5dd Reviewed-on: https://code.wireshark.org/review/30031 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/stat_tap_ui.c')
-rw-r--r--epan/stat_tap_ui.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/epan/stat_tap_ui.c b/epan/stat_tap_ui.c
index c54d22463a..e8020106e1 100644
--- a/epan/stat_tap_ui.c
+++ b/epan/stat_tap_ui.c
@@ -79,15 +79,16 @@ register_stat_tap_ui(stat_tap_ui *ui, void *userdata)
* Function called for a stat command-line argument
* ********************************************************************** */
gboolean
-process_stat_cmd_arg(char *optstr)
+process_stat_cmd_arg(const char *optstr)
{
wmem_list_frame_t *entry;
stat_cmd_arg *sca;
stat_requested *tr;
+ char *stat_command = g_strdup(optstr);
/* Renamed in Wireshark 3.0, backwards compatibility. */
- if (!strncmp(optstr, "follow,ssl", strlen("follow,ssl"))) {
- memcpy(optstr + 7, "tls", 3);
+ if (!strncmp(stat_command, "follow,ssl", strlen("follow,ssl"))) {
+ memcpy(stat_command + 7, "tls", 3);
}
/* The strings "ipx" or "ipv6" must be tested before "ip" to select the
@@ -95,14 +96,15 @@ process_stat_cmd_arg(char *optstr)
walked backwards */
for (entry = wmem_list_tail(stat_cmd_arg_list); entry; entry = wmem_list_frame_prev(entry)) {
sca = (stat_cmd_arg*)wmem_list_frame_data(entry);
- if(!strncmp(sca->cmd, optstr, strlen(sca->cmd))) {
+ if (!strncmp(sca->cmd, stat_command, strlen(sca->cmd))) {
tr=(stat_requested *)g_malloc(sizeof (stat_requested));
tr->sca = sca;
- tr->arg=g_strdup(optstr);
+ tr->arg = stat_command;
stats_requested = g_slist_append(stats_requested, tr);
return TRUE;
}
}
+ g_free(stat_command);
return FALSE;
}