diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-07-26 13:58:55 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-07-26 13:48:40 +0000 |
commit | 4713ce4476cadb2d4a8869dd2e6f19547841aa9a (patch) | |
tree | 49eb6200d40c11472aa3283236b3ad38ba0c2b45 /ui/gtk | |
parent | 3a3bf8926eaa57bbe3941cbb0fb5d30ad92ede11 (diff) |
Ensure to have a valid string pointer when writing OS SHB option
Change-Id: Ib0b6dcdf1700e88383d30bf43739312fce10e1c7
Reviewed-on: https://code.wireshark.org/review/16696
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/file_import_dlg.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index dc6a97a4f5..09e319126a 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -465,6 +465,7 @@ file_import_open(text_import_info_t *info) wtapng_if_descr_mandatory_t *int_data_mand; GString *os_info_str; gsize opt_len; + gchar *opt_str; /* Create data for SHB */ os_info_str = g_string_new(""); @@ -480,7 +481,11 @@ file_import_open(text_import_info_t *info) * this section. */ opt_len = os_info_str->len; - wtap_block_add_string_option(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len); + opt_str = g_string_free(os_info_str, FALSE); + if (opt_str) { + wtap_block_add_string_option(shb_hdr, OPT_SHB_OS, opt_str, opt_len); + g_free(opt_str); + } /* * UTF-8 string containing the name of the application used to create * this section. |