diff options
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/merge.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c index 82154f9bfd..a5dfc0b050 100644 --- a/wiretap/merge.c +++ b/wiretap/merge.c @@ -490,7 +490,6 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count, GString *comment_gstr; GString *os_info_str; guint i; - char* shb_comment = NULL; wtapng_section_mandatory_t* shb_data; gsize opt_len; gchar *opt_str; @@ -505,14 +504,7 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count, * * XXX - do we want some way to record which comments, hardware/OS/app * descriptions, IDBs, etc.? came from which files? - * - * XXX - fix this to handle multiple comments from a single file. */ - if (wtap_block_get_nth_string_option_value(shb_hdr, OPT_COMMENT, 0, &shb_comment) == WTAP_OPTTYPE_SUCCESS && - strlen(shb_comment) > 0) { - /* very lame way to save comments - does not save them from the other files */ - g_string_append_printf(comment_gstr, "%s \n",shb_comment); - } g_string_append_printf(comment_gstr, "File created by merging: \n"); @@ -527,9 +519,14 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count, shb_data->section_length = -1; /* TODO: handle comments from each file being merged */ opt_len = comment_gstr->len; + /* XXX: 65535 is the maximum size for an option (hence comment) in pcapng. + * Truncate it? Let wiretap/pcapng.c decide what to do? (Currently it + * writes nothing without reporting an error.) What if we support other + * output file formats later? + */ opt_str = g_string_free(comment_gstr, FALSE); - wtap_block_set_nth_string_option_value(shb_hdr, OPT_COMMENT, 0, opt_str, opt_len); /* section comment */ - g_free(opt_str); + /* XXX: We probably want to prepend (insert at index 0) instead? */ + wtap_block_add_string_option_owned(shb_hdr, OPT_COMMENT, opt_str); /* * XXX - and how do we preserve all the OPT_SHB_HARDWARE, OPT_SHB_OS, * and OPT_SHB_USERAPPL values from all the previous files? |