aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/merge.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-05-19 22:28:43 -0400
committerMichael Mann <mmann78@netscape.net>2016-05-22 23:39:14 +0000
commit81d65ccec65c9bbe972fcb64933fc34d9679562c (patch)
treec84fcfbb3befcd535b470310a8d8cf48b63dfc1e /wiretap/merge.c
parent6a992182ce47d721ce73eabf99983cea480dcf97 (diff)
Add wtap_optionblock_set_option_string_format
Also add a length parameter to wtap_optionblock_set_option_string Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee Reviewed-on: https://code.wireshark.org/review/15505 Reviewed-by: Anthony Coddington <anthony.coddington@endace.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap/merge.c')
-rw-r--r--wiretap/merge.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 83ad2f35e6..52709c8948 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -370,6 +370,7 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count,
guint i;
char* shb_comment = NULL;
wtapng_mandatory_section_t* shb_data;
+ gsize opt_len;
shb_hdr = wtap_file_get_shb_for_new_file(in_files[0].wth);
@@ -396,13 +397,15 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count,
shb_data = (wtapng_mandatory_section_t*)wtap_optionblock_get_mandatory_data(shb_hdr);
shb_data->section_length = -1;
/* TODO: handle comments from each file being merged */
- wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, g_string_free(comment_gstr, TRUE)); /* section comment */
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_HARDWARE, NULL ); /* NULL if not available, UTF-8 string containing the */
+ opt_len = comment_gstr->len;
+ wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, g_string_free(comment_gstr, TRUE), opt_len); /* section comment */
+ wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_HARDWARE, NULL, 0 ); /* NULL if not available, UTF-8 string containing the */
/* description of the hardware used to create this section. */
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE)); /* UTF-8 string containing the name */
+ opt_len = os_info_str->len;
+ wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE), opt_len); /* UTF-8 string containing the name */
/* of the operating system used to create this section. */
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_USERAPPL, (char*)app_name ); /* NULL if not available, UTF-8 string containing the name */
+ wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_USERAPPL, (char*)app_name, app_name ? strlen(app_name): 0 ); /* NULL if not available, UTF-8 string containing the name */
/* of the application used to create this section. */
return shb_hdr;