aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-01-07 18:13:23 -0500
committerAnders Broman <a.broman58@gmail.com>2015-01-08 05:43:51 +0000
commit4a5ca5c76e199694bba8a21418f52ca0f30322d1 (patch)
tree00b8ed5cce77a17af6e0fb388fe42c6ffa8a9262
parent22096781499c7159ff504f7baa743d295aad06bc (diff)
bytes_to_ep_str -> bytes_to_str
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/crypt/airpdcap.c6
-rw-r--r--epan/crypt/airpdcap_debug.h7
-rw-r--r--epan/dissectors/packet-ap1394.c5
-rw-r--r--epan/dissectors/packet-arp.c6
-rw-r--r--epan/dissectors/packet-ber.c2
-rw-r--r--epan/dissectors/packet-btsdp.c2
-rw-r--r--epan/dissectors/packet-isakmp.c2
-rw-r--r--epan/dissectors/packet-ncp2222.inc6
-rw-r--r--epan/dissectors/packet-rtmpt.c4
-rw-r--r--epan/dissectors/packet-sigcomp.c2
-rw-r--r--epan/dissectors/packet-ssl-utils.c5
-rw-r--r--epan/dissectors/packet-ubertooth.c2
-rw-r--r--epan/dissectors/packet-yami.c4
-rw-r--r--epan/sigcomp-udvm.c6
-rw-r--r--epan/sigcomp_state_hdlr.c14
-rw-r--r--epan/to_str.c27
-rw-r--r--epan/to_str.h6
-rw-r--r--ui/gtk/lbm_stream_dlg.c10
-rw-r--r--ui/gtk/lbm_uimflow_dlg.c8
-rw-r--r--ui/gtk/mcast_stream.c4
-rw-r--r--ui/qt/lbm_stream_dialog.cpp2
-rw-r--r--ui/qt/lbm_uimflow_dialog.cpp4
-rw-r--r--ui/qt/uat_dialog.cpp7
23 files changed, 63 insertions, 78 deletions
diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c
index deef466ee8..1f599b9eb9 100644
--- a/epan/crypt/airpdcap.c
+++ b/epan/crypt/airpdcap.c
@@ -1835,7 +1835,7 @@ AirPDcapRsnaPwd2Psk(
decryption_key_t*
parse_key_string(gchar* input_string, guint8 key_type)
{
- gchar *key;
+ gchar *key, *tmp_str;
gchar *ssid;
GString *key_string = NULL;
@@ -1874,11 +1874,13 @@ parse_key_string(gchar* input_string, guint8 key_type)
dk->type = AIRPDCAP_KEY_TYPE_WEP;
/* XXX - The current key handling code in the GUI requires
* no separators and lower case */
- dk->key = g_string_new(bytes_to_ep_str(key_ba->data, key_ba->len));
+ tmp_str = bytes_to_str(NULL, key_ba->data, key_ba->len);
+ dk->key = g_string_new(tmp_str);
g_string_ascii_down(dk->key);
dk->bits = key_ba->len * 8;
dk->ssid = NULL;
+ wmem_free(NULL, tmp_str);
g_byte_array_free(key_ba, TRUE);
return dk;
}
diff --git a/epan/crypt/airpdcap_debug.h b/epan/crypt/airpdcap_debug.h
index 4facb6303f..82b686c94a 100644
--- a/epan/crypt/airpdcap_debug.h
+++ b/epan/crypt/airpdcap_debug.h
@@ -87,7 +87,12 @@ void print_debug_line(const CHAR *function, const CHAR *msg, const INT level);
#endif
#endif
-#define DEBUG_DUMP(x,y,z) g_warning("%s: %s", x, bytes_to_ep_str(y, (z)))
+#define DEBUG_DUMP(x,y,z) \
+ { \
+ char* tmp_str = (char*)bytes_to_str(NULL, y, (z)); \
+ g_warning("%s: %s", x, ) \
+ wmem_free(NULL, tmp_str); \
+ }
#else /* !defined _DEBUG */
diff --git a/epan/dissectors/packet-ap1394.c b/epan/dissectors/packet-ap1394.c
index 6c15804322..eaa2483a9e 100644
--- a/epan/dissectors/packet-ap1394.c
+++ b/epan/dissectors/packet-ap1394.c
@@ -66,24 +66,21 @@ dissect_ap1394(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *fh_tree = NULL;
- const guint8 *src_addr, *dst_addr;
guint16 etype;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/IEEE1394");
col_clear(pinfo->cinfo, COL_INFO);
- src_addr=tvb_get_ptr(tvb, 8, 8);
TVB_SET_ADDRESS(&pinfo->dl_src, AT_EUI64, tvb, 8, 8);
TVB_SET_ADDRESS(&pinfo->src, AT_EUI64, tvb, 8, 8);
- dst_addr=tvb_get_ptr(tvb, 0, 8);
TVB_SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, tvb, 0, 8);
TVB_SET_ADDRESS(&pinfo->dst, AT_EUI64, tvb, 0, 8);
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_ap1394, tvb, 0, 18,
"Apple IP-over-IEEE 1394, Src: %s, Dst: %s",
- bytes_to_ep_str(src_addr, 8), bytes_to_ep_str(dst_addr, 8));
+ address_to_str(wmem_packet_scope(), &pinfo->src), address_to_str(wmem_packet_scope(), &pinfo->dst));
fh_tree = proto_item_add_subtree(ti, ett_ap1394);
proto_tree_add_item(fh_tree, hf_ap1394_dst, tvb, 0, 8, ENC_NA);
proto_tree_add_item(fh_tree, hf_ap1394_src, tvb, 8, 8, ENC_NA);
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c
index 5ab5edf64e..ada4fb0a1c 100644
--- a/epan/dissectors/packet-arp.c
+++ b/epan/dissectors/packet-arp.c
@@ -397,7 +397,7 @@ arpproaddr_to_str(const guint8 *ad, int ad_len, guint16 type)
return address_to_str(wmem_packet_scope(), &addr);
}
}
- return bytes_to_ep_str(ad, ad_len);
+ return bytes_to_str(wmem_packet_scope(), ad, ad_len);
}
#define MAX_E164_STR_LEN 20
@@ -431,7 +431,7 @@ atmarpnum_to_str(const guint8 *ad, int ad_tl)
*
* XXX - break down into subcomponents.
*/
- return bytes_to_ep_str(ad, ad_len);
+ return bytes_to_str(wmem_packet_scope(), ad, ad_len);
}
}
@@ -452,7 +452,7 @@ atmarpsubaddr_to_str(const guint8 *ad, int ad_tl)
*
* XXX - break down into subcomponents?
*/
- return bytes_to_ep_str(ad, ad_len);
+ return bytes_to_str(wmem_packet_scope(), ad, ad_len);
}
const value_string arp_hrd_vals[] = {
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index d5baf3c80b..6784dc0048 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -3964,7 +3964,7 @@ dissect_ber_constrained_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto
if (bitstring[byteno]) {
expert_add_info_format(
actx->pinfo, item, &ei_ber_bits_unknown,
- "Unknown bit(s): 0x%s", bytes_to_ep_str(bitstring, len));
+ "Unknown bit(s): 0x%s", bytes_to_str(wmem_packet_scope(), bitstring, len));
break;
}
}
diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c
index 0fe6837e54..82385b76eb 100644
--- a/epan/dissectors/packet-btsdp.c
+++ b/epan/dissectors/packet-btsdp.c
@@ -910,7 +910,7 @@ print_uuid(uuid_t *uuid)
i_uuid += 1;
}
- return bytes_to_ep_str(uuid->data, uuid->size);
+ return bytes_to_str(wmem_packet_scope(), uuid->data, uuid->size);
}
}
diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c
index 6afb452314..fbcfe9f9e5 100644
--- a/epan/dissectors/packet-isakmp.c
+++ b/epan/dissectors/packet-isakmp.c
@@ -4739,7 +4739,7 @@ dissect_enc(tvbuff_t *tvb,
if (tvb_memeql(tvb, offset, md, icd_len) == 0) {
proto_item_append_text(icd_item, "[correct]");
} else {
- proto_item_append_text(icd_item, "[incorrect, should be %s]", bytes_to_ep_str(md, icd_len));
+ proto_item_append_text(icd_item, "[incorrect, should be %s]", bytes_to_str(wmem_packet_scope(), md, icd_len));
expert_add_info(pinfo, icd_item, &ei_isakmp_ikev2_integrity_checksum);
}
gcry_md_close(md_hd);
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc
index f0af06b55f..9c2fbc2eb2 100644
--- a/epan/dissectors/packet-ncp2222.inc
+++ b/epan/dissectors/packet-ncp2222.inc
@@ -2782,7 +2782,7 @@ build_expert_data(proto_tree *ncp_tree, const char *hf_name, char *buffer,
}
case 21:
case 22: /* Bytes */
- g_snprintf(buffer, (gulong) buffer_size, "%s", bytes_to_ep_str(get_finfo_value_string(PTREE_FINFO(tree_pointer)), get_finfo_length(PTREE_FINFO(tree_pointer))));
+ g_snprintf(buffer, (gulong) buffer_size, "%s", bytes_to_str(wmem_packet_scope(), get_finfo_value_string(PTREE_FINFO(tree_pointer)), get_finfo_length(PTREE_FINFO(tree_pointer))));
break;
default: /* Dont currently handle. Only need string, integers, and bytes */
g_snprintf(buffer, (gulong) buffer_size, "Unsupported Expert Type");
@@ -7744,7 +7744,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
if (info_type != 0) { /* Is this a string or not? */
if (info_type == 1) { /* Is this bytes? */
- byte_string = bytes_to_ep_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
+ byte_string = bytes_to_str(wmem_packet_scope(), get_finfo_value_string(finfo), get_finfo_length(finfo));
col_append_fstr(pinfo->cinfo, COL_INFO,
(const gchar*) ncp_rec->req_info_str->first_string,
byte_string);
@@ -7781,7 +7781,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
if (info_type != 0) { /* Is this a string or not? */
if (info_type == 1)
{ /* Is this bytes? */
- byte_string = bytes_to_ep_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
+ byte_string = bytes_to_str(wmem_packet_scope(), get_finfo_value_string(finfo), get_finfo_length(finfo));
col_append_fstr(pinfo->cinfo, COL_INFO,
(const gchar*) ncp_rec->req_info_str->repeat_string,
byte_string);
diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c
index bdc2504882..703386a3d5 100644
--- a/epan/dissectors/packet-rtmpt.c
+++ b/epan/dissectors/packet-rtmpt.c
@@ -1530,9 +1530,9 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
iValueOffset += iValueLength;
iByteArrayValue = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, iValueOffset, iArrayLength);
proto_tree_add_bytes(val_tree, hf_amf_bytearray, tvb, iValueOffset, iArrayLength, iByteArrayValue);
- proto_item_append_text(ti, " %s", bytes_to_ep_str(iByteArrayValue, iArrayLength));
+ proto_item_append_text(ti, " %s", bytes_to_str(wmem_packet_scope(), iByteArrayValue, iArrayLength));
if (parent_ti != NULL)
- proto_item_append_text(parent_ti, " %s", bytes_to_ep_str(iByteArrayValue, iArrayLength));
+ proto_item_append_text(parent_ti, " %s", bytes_to_str(wmem_packet_scope(), iByteArrayValue, iArrayLength));
} else {
/* the upper 28 bits of the integer value are a object reference index */
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c
index 59e8b77d10..a2d1fc0e41 100644
--- a/epan/dissectors/packet-sigcomp.c
+++ b/epan/dissectors/packet-sigcomp.c
@@ -690,7 +690,7 @@ dissect_sigcomp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sigcomp_tr
offset = offset + len;
}
tvb_memcpy(tvb, partial_state, offset, partial_state_len);
- partial_state_str = bytes_to_ep_str(partial_state, partial_state_len);
+ partial_state_str = bytes_to_str(wmem_packet_scope(), partial_state, partial_state_len);
proto_tree_add_string(sigcomp_tree,hf_sigcomp_partial_state,
tvb, offset, partial_state_len, partial_state_str);
offset = offset + partial_state_len;
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index aef9101385..d369a504de 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -3603,6 +3603,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd, char** err) {
static char buf_name[256];
static char buf_email[128];
unsigned char buf_keyid[32];
+ char *tmp_str;
gnutls_pkcs12_t ssl_p12 = NULL;
gnutls_x509_crt_t ssl_cert = NULL;
@@ -3726,7 +3727,9 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd, char** err) {
if (ret < 0) { g_strlcpy(buf_keyid, "<ERROR>", 32); }
private_key->x509_cert = ssl_cert;
- ssl_debug_printf( "Certificate imported: %s <%s>, KeyID %s\n", buf_name, buf_email, bytes_to_ep_str(buf_keyid, (int) buf_len));
+ tmp_str = bytes_to_str(NULL, buf_keyid, (int) buf_len);
+ ssl_debug_printf( "Certificate imported: %s <%s>, KeyID %s\n", buf_name, buf_email, tmp_str);
+ wmem_free(NULL, tmp_str);
break;
case GNUTLS_BAG_PKCS8_KEY:
diff --git a/epan/dissectors/packet-ubertooth.c b/epan/dissectors/packet-ubertooth.c
index 4eef348ac0..8b7fefdb6f 100644
--- a/epan/dissectors/packet-ubertooth.c
+++ b/epan/dissectors/packet-ubertooth.c
@@ -1781,7 +1781,7 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
proto_tree_add_bytes(main_tree, hf_serial_number, tvb,
offset, 16, (guint8 *) serial);
col_append_fstr(pinfo->cinfo, COL_INFO, " = %s",
- bytes_to_ep_str((guint8 *) serial, 16));
+ bytes_to_str(wmem_packet_scope(), (guint8 *) serial, 16));
offset += 16;
break;
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c
index 61533043d4..7f66e90c94 100644
--- a/epan/dissectors/packet-yami.c
+++ b/epan/dissectors/packet-yami.c
@@ -231,7 +231,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
offset += 4;
val = tvb_get_ptr(tvb, offset, val_len);
- repr = bytes_to_ep_str(val, val_len);
+ repr = bytes_to_str(wmem_packet_scope(), val, val_len);
proto_item_append_text(ti, ", Type: binary, Value: %s", repr);
offset += (val_len + 3) & ~3;
@@ -395,7 +395,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *
offset += 4;
val = tvb_get_ptr(tvb, offset, val_len);
- repr = bytes_to_ep_str(val, val_len);
+ repr = bytes_to_str(wmem_packet_scope(), val, val_len);
proto_item_append_text(ti, "%s, ", repr);
offset += (val_len + 3) & ~3;
diff --git a/epan/sigcomp-udvm.c b/epan/sigcomp-udvm.c
index f7b75fa79d..8dc6d1f312 100644
--- a/epan/sigcomp-udvm.c
+++ b/epan/sigcomp-udvm.c
@@ -892,7 +892,7 @@ execute_next_instruction:
if (print_level_2 ){
proto_tree_add_text(udvm_tree, message_tvb, 0, -1,
"Calculated SHA-1: %s",
- bytes_to_ep_str(sha1_digest_buf, STATE_BUFFER_SIZE));
+ bytes_to_str(wmem_packet_scope(), sha1_digest_buf, STATE_BUFFER_SIZE));
}
current_address = next_operand_address;
@@ -2695,7 +2695,7 @@ execute_next_instruction:
sha1_update( &ctx, (guint8 *) sha1buff, state_length_buff[n] + 8);
sha1_finish( &ctx, sha1_digest_buf );
if (print_level_3 ){
- proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"SHA1 digest %s",bytes_to_ep_str(sha1_digest_buf, STATE_BUFFER_SIZE));
+ proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"SHA1 digest %s", bytes_to_str(wmem_packet_scope(), sha1_digest_buf, STATE_BUFFER_SIZE));
}
/* begin partial state-id change cco@iptel.org */
@@ -2705,7 +2705,7 @@ execute_next_instruction:
udvm_state_create(sha1buff, sha1_digest_buf, STATE_MIN_ACCESS_LEN);
/* end partial state-id change cco@iptel.org */
proto_tree_add_text(udvm_tree,bytecode_tvb, 0, -1,"### Creating state ###");
- proto_tree_add_string(udvm_tree,hf_id, bytecode_tvb, 0, 0, bytes_to_ep_str(sha1_digest_buf, STATE_MIN_ACCESS_LEN));
+ proto_tree_add_string(udvm_tree,hf_id, bytecode_tvb, 0, 0, bytes_to_str(wmem_packet_scope(), sha1_digest_buf, STATE_MIN_ACCESS_LEN));
n++;
diff --git a/epan/sigcomp_state_hdlr.c b/epan/sigcomp_state_hdlr.c
index fdc6ae3ef4..575a36debe 100644
--- a/epan/sigcomp_state_hdlr.c
+++ b/epan/sigcomp_state_hdlr.c
@@ -627,7 +627,7 @@ sigcomp_init_udvm(void){
*/
sip_sdp_buff = (guint8 *)g_malloc(SIP_SDP_STATE_LENGTH + 8);
- partial_state_str = bytes_to_ep_str(sip_sdp_state_identifier, 6);
+ partial_state_str = bytes_to_str(NULL, sip_sdp_state_identifier, 6);
/*
* Debug g_warning("Sigcomp init: Storing partial state =%s",partial_state_str);
@@ -638,6 +638,7 @@ sigcomp_init_udvm(void){
memcpy(sip_sdp_buff+8, sip_sdp_static_dictionaty_for_sigcomp, SIP_SDP_STATE_LENGTH);
g_hash_table_insert(state_buffer_table, g_strdup(partial_state_str), sip_sdp_buff);
+ wmem_free(NULL, partial_state_str);
/* Debug
* g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);
* g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);
@@ -645,7 +646,7 @@ sigcomp_init_udvm(void){
presence_buff = (guint8 *)g_malloc(PRESENCE_STATE_LENGTH + 8);
- partial_state_str = bytes_to_ep_str(presence_state_identifier, 6);
+ partial_state_str = bytes_to_str(NULL, presence_state_identifier, 6);
memset(presence_buff, 0, 8);
presence_buff[0] = PRESENCE_STATE_LENGTH >> 8;
@@ -653,6 +654,7 @@ sigcomp_init_udvm(void){
memcpy(presence_buff+8, presence_static_dictionary_for_sigcomp, PRESENCE_STATE_LENGTH);
g_hash_table_insert(state_buffer_table, g_strdup(partial_state_str), presence_buff);
+ wmem_free(NULL, partial_state_str);
}
@@ -694,7 +696,7 @@ int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_
partial_state[n] = buff[p_id_start + n];
n++;
}
- partial_state_str = bytes_to_ep_str(partial_state, p_id_length);
+ partial_state_str = bytes_to_str(wmem_packet_scope(), partial_state, p_id_length);
proto_tree_add_text(tree,tvb, 0, -1,"### Accessing state ###");
proto_tree_add_string(tree,hf_id, tvb, 0, 0, partial_state_str);
@@ -822,7 +824,7 @@ void udvm_state_create(guint8 *state_buff,guint8 *state_identifier,guint16 p_id_
partial_state[i] = state_identifier[i];
i++;
}
- partial_state_str = bytes_to_ep_str(partial_state, p_id_length);
+ partial_state_str = bytes_to_str(NULL, partial_state, p_id_length);
dummy_buff = (gchar *)g_hash_table_lookup(state_buffer_table, partial_state_str);
if ( dummy_buff == NULL ){
@@ -833,6 +835,7 @@ void udvm_state_create(guint8 *state_buff,guint8 *state_identifier,guint16 p_id_
g_free(state_buff);
}
+ wmem_free(NULL, partial_state_str);
}
#if 1
@@ -851,7 +854,7 @@ void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){
partial_state[i] = buff[p_id_start + i];
i++;
}
- partial_state_str = bytes_to_ep_str(partial_state, p_id_length);
+ partial_state_str = bytes_to_str(NULL, partial_state, p_id_length);
/* TODO Implement a state create counter before actually freeing states
* Hmm is it a good idea to free the buffer at all?
*/
@@ -863,6 +866,7 @@ void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){
g_hash_table_remove (state_buffer_table, partial_state_str);
g_free(dummy_buff);
}
+ wmem_free(NULL, partial_state_str);
}
#endif
diff --git a/epan/to_str.c b/epan/to_str.c
index 36ede9bbe8..b2b0e14181 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -199,33 +199,6 @@ bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len,
return buf;
}
-gchar *
-bytes_to_ep_str(const guint8 *bd, int bd_len)
-{
- gchar *cur;
- gchar *cur_ptr;
- int truncated = 0;
-
- if (!bd)
- REPORT_DISSECTOR_BUG("Null pointer passed to bytes_to_ep_str()");
-
- cur=(gchar *)ep_alloc(MAX_BYTE_STR_LEN+3+1);
- if (bd_len <= 0) { cur[0] = '\0'; return cur; }
-
- if (bd_len > MAX_BYTE_STR_LEN/2) { /* bd_len > 24 */
- truncated = 1;
- bd_len = MAX_BYTE_STR_LEN/2;
- }
-
- cur_ptr = bytes_to_hexstr(cur, bd, bd_len); /* max MAX_BYTE_STR_LEN bytes */
-
- if (truncated)
- cur_ptr = g_stpcpy(cur_ptr, "..."); /* 3 bytes */
-
- *cur_ptr = '\0'; /* 1 byte */
- return cur;
-}
-
char *
bytes_to_str(wmem_allocator_t *allocator, const guint8 *bd, int bd_len)
{
diff --git a/epan/to_str.h b/epan/to_str.h
index 1f4c90e22e..a0b10d08ba 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -120,15 +120,11 @@ WS_DLL_PUBLIC gchar* tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *t
/** Turn an array of bytes into a string showing the bytes in hex.
*
+ * @param scope memory allocation scheme used
* @param bd A pointer to the byte array
* @param bd_len The length of the byte array
* @return A pointer to the formatted string
*/
-WS_DLL_PUBLIC gchar *bytes_to_ep_str(const guint8 *bd, int bd_len);
-
-/**
- * Same as above, but using wmem memory management.
- */
WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *allocator, const guint8 *bd, int bd_len);
/** Turn an array of bytes into a string showing the bytes in hex,
diff --git a/ui/gtk/lbm_stream_dlg.c b/ui/gtk/lbm_stream_dlg.c
index a443f7162f..4478ffbe67 100644
--- a/ui/gtk/lbm_stream_dlg.c
+++ b/ui/gtk/lbm_stream_dlg.c
@@ -82,19 +82,19 @@ typedef struct
static lbmc_stream_dlg_info_t * global_stream_dialog_info = NULL;
-static gchar * lbmc_stream_dlg_format_endpoint_ep(const lbm_uim_stream_endpoint_t * endpoint)
+static gchar * lbmc_stream_dlg_format_endpoint(wmem_allocator_t *allocator, const lbm_uim_stream_endpoint_t * endpoint)
{
gchar * buf = NULL;
char* addr_str;
if (endpoint->type == lbm_uim_instance_stream)
{
- buf = bytes_to_ep_str(endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst));
+ buf = bytes_to_str(allocator, endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst));
}
else
{
addr_str = (char*)address_to_str(NULL, &(endpoint->stream_info.dest.addr));
- buf = ep_strdup_printf(
+ buf = wmem_strdup_printf(allocator,
"%" G_GUINT32_FORMAT ":%s:%" G_GUINT16_FORMAT,
endpoint->stream_info.dest.domain,
addr_str,
@@ -570,8 +570,8 @@ static gboolean lbmc_stream_dlg_tap_packet(void * tap_data, packet_info * pinfo,
stream = (lbmc_stream_dlg_stream_entry_t *)g_malloc(sizeof(lbmc_stream_dlg_stream_entry_t));
stream->channel = tapinfo->channel;
- stream->endpoint_a = wmem_strdup(wmem_file_scope(), lbmc_stream_dlg_format_endpoint_ep(&(tapinfo->endpoint_a)));
- stream->endpoint_b = wmem_strdup(wmem_file_scope(), lbmc_stream_dlg_format_endpoint_ep(&(tapinfo->endpoint_b)));
+ stream->endpoint_a = lbmc_stream_dlg_format_endpoint(wmem_file_scope(), &(tapinfo->endpoint_a));
+ stream->endpoint_b = lbmc_stream_dlg_format_endpoint(wmem_file_scope(), &(tapinfo->endpoint_b));
stream->first_frame = (guint32)(~0);
stream->last_frame = 0;
stream->messages = 0;
diff --git a/ui/gtk/lbm_uimflow_dlg.c b/ui/gtk/lbm_uimflow_dlg.c
index 10ced5da84..729e45d374 100644
--- a/ui/gtk/lbm_uimflow_dlg.c
+++ b/ui/gtk/lbm_uimflow_dlg.c
@@ -94,8 +94,8 @@ static int lbmc_uim_flow_graph_add_to_graph(packet_info * pinfo, const lbm_uim_s
lbm_uim_stream_endpoint_t epa;
lbm_uim_stream_endpoint_t epb;
seq_analysis_item_t * item;
- gchar * ctxinst1 = NULL;
- gchar * ctxinst2 = NULL;
+ gchar * ctxinst1;
+ gchar * ctxinst2;
gboolean swap_endpoints = FALSE;
int rc;
@@ -179,8 +179,8 @@ static int lbmc_uim_flow_graph_add_to_graph(packet_info * pinfo, const lbm_uim_s
}
if (epa.type == lbm_uim_instance_stream)
{
- ctxinst1 = bytes_to_ep_str(epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst));
- ctxinst2 = bytes_to_ep_str(epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst));
+ ctxinst1 = bytes_to_str(pinfo->pool, epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst));
+ ctxinst2 = bytes_to_str(pinfo->pool, epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst));
item->comment = g_strdup_printf("%s <-> %s [%" G_GUINT64_FORMAT "]",
ctxinst1,
ctxinst2,
diff --git a/ui/gtk/mcast_stream.c b/ui/gtk/mcast_stream.c
index cd9f63d308..31a203c1e3 100644
--- a/ui/gtk/mcast_stream.c
+++ b/ui/gtk/mcast_stream.c
@@ -175,8 +175,8 @@ mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
* address (for IPv6).
*/
if ((pinfo->dl_dst.type != AT_ETHER) ||
- ((g_ascii_strncasecmp("01005E", bytes_to_ep_str((const guint8 *)pinfo->dl_dst.data, pinfo->dl_dst.len), 6) != 0) &&
- (g_ascii_strncasecmp("3333", bytes_to_ep_str((const guint8 *)pinfo->dl_dst.data, pinfo->dl_dst.len), 4) != 0)) )
+ ((g_ascii_strncasecmp("01005E", bytes_to_str(pinfo->pool, (const guint8 *)pinfo->dl_dst.data, pinfo->dl_dst.len), 6) != 0) &&
+ (g_ascii_strncasecmp("3333", bytes_to_str(pinfo->pool, (const guint8 *)pinfo->dl_dst.data, pinfo->dl_dst.len), 4) != 0)) )
return 0;
/* check whether we already have a stream with these parameters in the list */
diff --git a/ui/qt/lbm_stream_dialog.cpp b/ui/qt/lbm_stream_dialog.cpp
index 3fecb31260..657f1b68d1 100644
--- a/ui/qt/lbm_stream_dialog.cpp
+++ b/ui/qt/lbm_stream_dialog.cpp
@@ -193,7 +193,7 @@ QString LBMStreamEntry::formatEndpoint(const packet_info * pinfo, const lbm_uim_
{
if (endpoint->type == lbm_uim_instance_stream)
{
- return QString(bytes_to_ep_str(endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst)));
+ return QString(bytes_to_str(pinfo->pool, endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst)));
}
else
{
diff --git a/ui/qt/lbm_uimflow_dialog.cpp b/ui/qt/lbm_uimflow_dialog.cpp
index 11a5a82c42..a6c253bdbf 100644
--- a/ui/qt/lbm_uimflow_dialog.cpp
+++ b/ui/qt/lbm_uimflow_dialog.cpp
@@ -133,8 +133,8 @@ static gboolean lbm_uimflow_add_to_graph(seq_analysis_info_t * seq_info, packet_
}
if (epa.type == lbm_uim_instance_stream)
{
- ctxinst1 = bytes_to_ep_str(epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst));
- ctxinst2 = bytes_to_ep_str(epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst));
+ ctxinst1 = bytes_to_str(pinfo->pool, epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst));
+ ctxinst2 = bytes_to_str(pinfo->pool, epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst));
item->comment = g_strdup_printf("%s <-> %s [%" G_GUINT64_FORMAT "]",
ctxinst1,
ctxinst2,
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
index bd6d9b768f..9a1128ae32 100644
--- a/ui/qt/uat_dialog.cpp
+++ b/ui/qt/uat_dialog.cpp
@@ -173,7 +173,12 @@ QString UatDialog::fieldString(guint row, guint column)
string_rep = str;
break;
case PT_TXTMOD_HEXBYTES: {
- string_rep = bytes_to_ep_str((const guint8 *) str, length);
+ {
+ char* temp_str = bytes_to_str(NULL, (const guint8 *) str, length);
+ QString qstr(temp_str);
+ string_rep = qstr;
+ wmem_free(NULL, temp_str);
+ }
break;
}
default: