summaryrefslogtreecommitdiff
path: root/ui/tap_export_pdu.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 /ui/tap_export_pdu.c
parent6a992182ce47d721ce73eabf99983cea480dcf97 (diff)
downloadwireshark-81d65ccec65c9bbe972fcb64933fc34d9679562c.tar.gz
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 'ui/tap_export_pdu.c')
-rw-r--r--ui/tap_export_pdu.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index 3131973ed2..37706ba718 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -107,7 +107,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
wtap_optionblock_t int_data;
wtapng_if_descr_mandatory_t *int_data_mand;
GString *os_info_str;
- gchar *opt_comment, *wireshark_ver;
+ gsize opt_len;
/* Create data for SHB */
os_info_str = g_string_new("");
@@ -116,22 +116,20 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
shb_hdr = wtap_optionblock_create(WTAP_OPTION_BLOCK_NG_SECTION);
/* options */
- opt_comment = comment;
- wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, opt_comment);
- g_free(opt_comment);
+ wtap_optionblock_set_option_string(shb_hdr, OPT_COMMENT, comment, strlen(comment));
+ g_free(comment);
/*
* UTF-8 string containing the name of the operating system used to create
* this section.
*/
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_OS, g_string_free(os_info_str, TRUE));
+ 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 application used to create
* this section.
*/
- wireshark_ver = g_strdup_printf("Wireshark %s", get_ws_vcs_version_info());
- wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_USERAPPL, wireshark_ver);
- g_free(wireshark_ver);
+ wtap_optionblock_set_option_string_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
/* Create fake IDB info */
idb_inf = g_new(wtapng_iface_descriptions_t,1);
@@ -145,7 +143,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
int_data_mand->link_type = wtap_wtap_encap_to_pcap_encap(WTAP_ENCAP_WIRESHARK_UPPER_PDU);
int_data_mand->snap_len = WTAP_MAX_PACKET_SIZE;
- wtap_optionblock_set_option_string(int_data, OPT_IDB_NAME, "Fake IF, PDU->Export");
+ wtap_optionblock_set_option_string(int_data, OPT_IDB_NAME, "Fake IF, PDU->Export", strlen("Fake IF, PDU->Export"));
wtap_optionblock_set_option_uint8(int_data, OPT_IDB_TSRESOL, 9);
g_array_append_val(idb_inf->interface_data, int_data);