Add _g_ to the names of functions that allocate glib memory. This is a bit more
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures that take the appropriate wmem pool. Majority of the conversion done with sed. svn path=/trunk/; revision=52164
This commit is contained in:
parent
8abfcaea79
commit
6df83e8078
|
@ -301,11 +301,11 @@ static uat_t *c1222_uat;
|
|||
#define FILL_START int length, start_offset = offset;
|
||||
#define FILL_TABLE(fieldname) \
|
||||
length = offset - start_offset; \
|
||||
fieldname = (guint8 *)tvb_memdup(tvb, start_offset, length); \
|
||||
fieldname = (guint8 *)tvb_g_memdup(tvb, start_offset, length); \
|
||||
fieldname##_len = length;
|
||||
#define FILL_TABLE_TRUNCATE(fieldname, len) \
|
||||
length = 1 + 2*(offset - start_offset); \
|
||||
fieldname = (guint8 *)tvb_memdup(tvb, start_offset, length); \
|
||||
fieldname = (guint8 *)tvb_g_memdup(tvb, start_offset, length); \
|
||||
fieldname##_len = len;
|
||||
#else /* HAVE_LIBGCRYPT */
|
||||
#define FILL_TABLE(fieldname)
|
||||
|
@ -919,7 +919,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
|
|||
return offset;
|
||||
encrypted = TRUE;
|
||||
if (c1222_decrypt) {
|
||||
buffer = (guchar *)tvb_memdup(tvb, offset, len2);
|
||||
buffer = (guchar *)tvb_g_memdup(tvb, offset, len2);
|
||||
if (!decrypt_packet(buffer, len2, TRUE)) {
|
||||
g_free(buffer);
|
||||
crypto_bad = TRUE;
|
||||
|
@ -938,7 +938,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
|
|||
len2 = tvb_length_remaining(tvb, offset);
|
||||
if (len2 <= 0)
|
||||
return offset;
|
||||
buffer = (guchar *)tvb_memdup(tvb, offset, len2);
|
||||
buffer = (guchar *)tvb_g_memdup(tvb, offset, len2);
|
||||
epsem_buffer = tvb_new_subset_remaining(tvb, offset);
|
||||
if (c1222_decrypt) {
|
||||
if (!decrypt_packet(buffer, len2, FALSE)) {
|
||||
|
|
|
@ -194,7 +194,7 @@ char *mechanism = NULL;
|
|||
* different type and/or mechanism.
|
||||
*/
|
||||
if(!actx->pinfo->fd->flags.visited) {
|
||||
mechanism = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
|
||||
mechanism = tvb_get_g_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
|
||||
ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */
|
||||
/*
|
||||
* If the mechanism in this request is an empty string (which is
|
||||
|
|
|
@ -154,7 +154,7 @@ RegistryAllocateHandleResponse/result AllocateHandleResponseResult
|
|||
|
||||
if(next_tvb) {
|
||||
|
||||
ns = tvb_get_string(t124NSIdentifier, 0, tvb_length(t124NSIdentifier));
|
||||
ns = tvb_get_g_string(t124NSIdentifier, 0, tvb_length(t124NSIdentifier));
|
||||
if(ns != NULL) {
|
||||
dissector_try_string(t124_ns_dissector_table, ns, next_tvb, actx->pinfo, top_tree);
|
||||
g_free(ns);
|
||||
|
|
|
@ -1273,7 +1273,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
proto_tree_add_item(sub_tree, hf_9P_parmsz, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
||||
|
||||
if (firstpass) {
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
|
||||
if (!strncmp(tvb_s, "9P2000.L", _9p_len)) {
|
||||
u32 = _9P2000_L;
|
||||
|
@ -1363,7 +1363,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
sub_tree = proto_item_add_subtree(ti, ett_9P_aname);
|
||||
proto_tree_add_item(sub_tree, hf_9P_parmsz, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
||||
if(firstpass) {
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
conv_set_fid(pinfo, fid, tvb_s, _9p_len+1);
|
||||
g_free(tvb_s);
|
||||
}
|
||||
|
@ -1409,7 +1409,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
}
|
||||
|
||||
if (firstpass) {
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
wmem_strbuf_append_c(tmppath, '/');
|
||||
wmem_strbuf_append(tmppath, tvb_s);
|
||||
g_free(tvb_s);
|
||||
|
@ -1484,7 +1484,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
|
||||
wmem_strbuf_append(tmppath, fid_path);
|
||||
wmem_strbuf_append_c(tmppath, '/');
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
wmem_strbuf_append(tmppath, tvb_s);
|
||||
g_free(tvb_s);
|
||||
}
|
||||
|
@ -1519,7 +1519,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
|
||||
wmem_strbuf_append(tmppath, fid_path);
|
||||
wmem_strbuf_append_c(tmppath, '/');
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
wmem_strbuf_append(tmppath, tvb_s);
|
||||
g_free(tvb_s);
|
||||
}
|
||||
|
@ -1935,7 +1935,7 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
wmem_strbuf_append(tmppath, conv_get_fid(pinfo, dfid));
|
||||
wmem_strbuf_append_c(tmppath, '/');
|
||||
|
||||
tvb_s = tvb_get_string(tvb, offset+2, _9p_len);
|
||||
tvb_s = tvb_get_g_string(tvb, offset+2, _9p_len);
|
||||
wmem_strbuf_append(tmppath, tvb_s);
|
||||
g_free(tvb_s);
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ dissect_bmc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
|
||||
/* Needs bit-reversing. Create a new buffer, copy the message to it and bit-reverse */
|
||||
len = tvb_length(tvb);
|
||||
reversing_buffer = (guint8 *)tvb_memdup(tvb, offset, len);
|
||||
reversing_buffer = (guint8 *)tvb_g_memdup(tvb, offset, len);
|
||||
p_rev = reversing_buffer;
|
||||
/* Entire message is bit reversed */
|
||||
for (i=0; i<len; i++, p_rev++)
|
||||
|
|
|
@ -625,7 +625,7 @@ dissect_attribute_entries(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
for (i_entry = 0; i_entry < count; ++i_entry) {
|
||||
attribute_id = tvb_get_ntohl(tvb, offset);
|
||||
value_length = tvb_get_ntohs(tvb, offset + 4 + 2);
|
||||
value = tvb_get_string(tvb, offset + 4 + 2 + 2, value_length);
|
||||
value = tvb_get_g_string(tvb, offset + 4 + 2 + 2, value_length);
|
||||
|
||||
if (attribute_id == 0x01) col_append_fstr(pinfo->cinfo, COL_INFO, " - Title: \"%s\"", value);
|
||||
|
||||
|
@ -663,7 +663,7 @@ dissect_item_mediaplayer(tvbuff_t *tvb, proto_tree *tree, gint offset)
|
|||
|
||||
item_length = tvb_get_ntohs(tvb, offset + 1);
|
||||
displayable_name_length = tvb_get_ntohs(tvb, offset + 1 + 2 + 1 + 1 + 4 + 16 + 1 + 2);
|
||||
displayable_name = tvb_get_string(tvb, offset + 1 + 2 + 1 + 1 + 4 + 16 + 1 + 2 + 2, displayable_name_length);
|
||||
displayable_name = tvb_get_g_string(tvb, offset + 1 + 2 + 1 + 1 + 4 + 16 + 1 + 2 + 2, displayable_name_length);
|
||||
|
||||
pitem = proto_tree_add_text(tree, tvb, offset, 1 + 2 + item_length, "Player: %s", displayable_name);
|
||||
ptree = proto_item_add_subtree(pitem, ett_btavrcp_player);
|
||||
|
@ -825,7 +825,7 @@ dissect_item_media_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
item_length = tvb_get_ntohs(tvb, offset + 1);
|
||||
displayable_name_length = tvb_get_ntohs(tvb, offset + 1 + 2 + 8 + 1 + 2);
|
||||
displayable_name = tvb_get_string(tvb, offset + 1 + 2 + 8 + 1 + 2 + 2, displayable_name_length);
|
||||
displayable_name = tvb_get_g_string(tvb, offset + 1 + 2 + 8 + 1 + 2 + 2, displayable_name_length);
|
||||
|
||||
pitem = proto_tree_add_text(tree, tvb, offset, 1 + 2 + item_length, "Element: %s", displayable_name);
|
||||
ptree = proto_item_add_subtree(pitem, ett_btavrcp_element);
|
||||
|
@ -877,7 +877,7 @@ dissect_item_folder(tvbuff_t *tvb, proto_tree *tree, gint offset)
|
|||
|
||||
item_length = tvb_get_ntohs(tvb, offset + 1);
|
||||
displayable_name_length = tvb_get_ntohs(tvb, offset + 1 + 2 + 8 + 1 + 1 + 2);
|
||||
displayable_name = tvb_get_string(tvb, offset + 1 + 2 + 8 + 1 + 1 + 2 + 2, displayable_name_length);
|
||||
displayable_name = tvb_get_g_string(tvb, offset + 1 + 2 + 8 + 1 + 1 + 2 + 2, displayable_name_length);
|
||||
|
||||
pitem = proto_tree_add_text(tree, tvb, offset, 1 + 2 + item_length, "Folder : %s", displayable_name);
|
||||
ptree = proto_item_add_subtree(pitem, ett_btavrcp_folder);
|
||||
|
@ -1903,7 +1903,7 @@ dissect_browsing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
folder_name_length = tvb_get_ntohs(tvb, offset);
|
||||
offset += 2;
|
||||
proto_tree_add_item(ptree, hf_btavrcp_folder_name, tvb, offset, folder_name_length, ENC_NA);
|
||||
folder_name = tvb_get_string(tvb, offset, folder_name_length);
|
||||
folder_name = tvb_get_g_string(tvb, offset, folder_name_length);
|
||||
offset += folder_name_length;
|
||||
proto_item_append_text(pitem, "%s/", folder_name);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "%s/", folder_name);
|
||||
|
|
|
@ -237,7 +237,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
guint8 *id;
|
||||
|
||||
proto_tree_add_item(tree, hf_bthcrp_control_1284_id, tvb, offset, -1, ENC_ASCII | ENC_NA);
|
||||
id = tvb_get_string(tvb, offset, tvb_length_remaining(tvb, offset));
|
||||
id = tvb_get_g_string(tvb, offset, tvb_length_remaining(tvb, offset));
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, " - 1284 ID: %s", id);
|
||||
offset += tvb_length_remaining(tvb, offset);
|
||||
}
|
||||
|
|
|
@ -349,11 +349,11 @@ static uat_t *c1222_uat;
|
|||
#define FILL_START int length, start_offset = offset;
|
||||
#define FILL_TABLE(fieldname) \
|
||||
length = offset - start_offset; \
|
||||
fieldname = (guint8 *)tvb_memdup(tvb, start_offset, length); \
|
||||
fieldname = (guint8 *)tvb_g_memdup(tvb, start_offset, length); \
|
||||
fieldname##_len = length;
|
||||
#define FILL_TABLE_TRUNCATE(fieldname, len) \
|
||||
length = 1 + 2*(offset - start_offset); \
|
||||
fieldname = (guint8 *)tvb_memdup(tvb, start_offset, length); \
|
||||
fieldname = (guint8 *)tvb_g_memdup(tvb, start_offset, length); \
|
||||
fieldname##_len = len;
|
||||
#else /* HAVE_LIBGCRYPT */
|
||||
#define FILL_TABLE(fieldname)
|
||||
|
@ -967,7 +967,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
|
|||
return offset;
|
||||
encrypted = TRUE;
|
||||
if (c1222_decrypt) {
|
||||
buffer = (guchar *)tvb_memdup(tvb, offset, len2);
|
||||
buffer = (guchar *)tvb_g_memdup(tvb, offset, len2);
|
||||
if (!decrypt_packet(buffer, len2, TRUE)) {
|
||||
g_free(buffer);
|
||||
crypto_bad = TRUE;
|
||||
|
@ -986,7 +986,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
|
|||
len2 = tvb_length_remaining(tvb, offset);
|
||||
if (len2 <= 0)
|
||||
return offset;
|
||||
buffer = (guchar *)tvb_memdup(tvb, offset, len2);
|
||||
buffer = (guchar *)tvb_g_memdup(tvb, offset, len2);
|
||||
epsem_buffer = tvb_new_subset_remaining(tvb, offset);
|
||||
if (c1222_decrypt) {
|
||||
if (!decrypt_packet(buffer, len2, FALSE)) {
|
||||
|
|
|
@ -74,7 +74,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
proto_item *ti;
|
||||
proto_tree *data_tree;
|
||||
if (new_pane) {
|
||||
guint8 *real_data = (guint8 *)tvb_memdup(tvb, 0, bytes);
|
||||
guint8 *real_data = (guint8 *)tvb_g_memdup(tvb, 0, bytes);
|
||||
data_tvb = tvb_new_child_real_data(tvb,real_data,bytes,bytes);
|
||||
tvb_set_free_cb(data_tvb, g_free);
|
||||
add_new_data_source(pinfo, data_tvb, "Not dissected data bytes");
|
||||
|
|
|
@ -7982,7 +7982,7 @@ dissect_packet_data(tvbuff_t *tvb ,tvbuff_t *auth_tvb _U_,
|
|||
}
|
||||
crypt_rc4_init(&rc4state,vars->encryption_key,16);
|
||||
crypt_rc4(&rc4state,(guint8*)©confounder,8);
|
||||
decrypted = (guint8*)tvb_memdup(tvb, offset,data_len);
|
||||
decrypted = (guint8*)tvb_g_memdup(tvb, offset,data_len);
|
||||
crypt_rc4_init(&rc4state,vars->encryption_key,16);
|
||||
crypt_rc4(&rc4state,decrypted,data_len);
|
||||
buf = tvb_new_child_real_data(tvb, decrypted, data_len, data_len);
|
||||
|
|
|
@ -166,7 +166,7 @@ dissect_null_term_wstring(tvbuff_t *tvb, int offset,
|
|||
len = tmp_offset - offset;
|
||||
|
||||
/* tvb_get_ephemeral_string didn't want the length with the 0*/
|
||||
s = tvb_get_unicode_string(tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
s = tvb_get_g_unicode_string(tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(tree, hf_index, tvb, offset, len, s);
|
||||
g_free(s);
|
||||
|
||||
|
|
|
@ -700,7 +700,7 @@ dissect_printerdata_data(tvbuff_t *tvb, int offset,
|
|||
|
||||
switch(type) {
|
||||
case DCERPC_REG_SZ: {
|
||||
char *data = tvb_get_unicode_string(tvb, offset - size, size, ENC_LITTLE_ENDIAN);
|
||||
char *data = tvb_get_g_unicode_string(tvb, offset - size, size, ENC_LITTLE_ENDIAN);
|
||||
|
||||
proto_item_append_text(item, ": %s", data);
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ dissect_spoolss_uint16uni(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
|
|||
return offset;
|
||||
}
|
||||
|
||||
text = tvb_get_unicode_string(tvb, offset, remaining, ENC_LITTLE_ENDIAN);
|
||||
text = tvb_get_g_unicode_string(tvb, offset, remaining, ENC_LITTLE_ENDIAN);
|
||||
len = (int)strlen(text);
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, len * 2, "%s: %s",
|
||||
|
@ -5908,7 +5908,7 @@ cb_notify_str_postprocess(packet_info *pinfo _U_,
|
|||
|
||||
len = tvb_get_letohl(tvb, start_offset);
|
||||
|
||||
s = tvb_get_unicode_string(
|
||||
s = tvb_get_g_unicode_string(
|
||||
tvb, start_offset + 4, (end_offset - start_offset - 4), ENC_LITTLE_ENDIAN);
|
||||
|
||||
/* Append string to upper-level proto_items */
|
||||
|
|
|
@ -4193,7 +4193,7 @@ dissect_dcerpc_cn_rts(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|||
const guint32 conformance_count = dcerpc_tvb_get_ntohl(tvb, offset, hdr->drep);
|
||||
proto_tree_add_uint(cn_rts_command_tree, hf_dcerpc_cn_rts_command_conformancecount, tvb, offset, 4, conformance_count);
|
||||
offset += 4;
|
||||
padding = (guint8 *)tvb_memdup(tvb, offset, conformance_count);
|
||||
padding = (guint8 *)tvb_g_memdup(tvb, offset, conformance_count);
|
||||
proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, conformance_count, padding);
|
||||
offset += conformance_count;
|
||||
} break;
|
||||
|
@ -4219,7 +4219,7 @@ dissect_dcerpc_cn_rts(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|||
offset += 16;
|
||||
} break;
|
||||
}
|
||||
padding = (guint8 *)tvb_memdup(tvb, offset, 12);
|
||||
padding = (guint8 *)tvb_g_memdup(tvb, offset, 12);
|
||||
proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, 12, padding);
|
||||
offset += 12;
|
||||
} break;
|
||||
|
|
|
@ -1106,7 +1106,7 @@ dissect_icqv5Client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
* bytes in the buffer.
|
||||
*/
|
||||
rounded_size = ((((capturedsize - ICQ5_CL_SESSIONID) + 3)/4)*4) + ICQ5_CL_SESSIONID;
|
||||
/* rounded_size might exceed the tvb bounds so we can't just use tvb_memdup here. */
|
||||
/* rounded_size might exceed the tvb bounds so we can't just use tvb_g_memdup here. */
|
||||
decr_pd = (guint8 *)g_malloc(rounded_size);
|
||||
tvb_memcpy(tvb, decr_pd, 0, capturedsize);
|
||||
decrypt_v5(decr_pd, rounded_size, key);
|
||||
|
|
|
@ -1882,7 +1882,7 @@ dissect_ieee802154_decrypt(tvbuff_t * tvb, guint offset, packet_info * pinfo, ie
|
|||
* We will decrypt the message in-place and then use the buffer as the
|
||||
* real data for the new tvb.
|
||||
*/
|
||||
text = (guint8 *)tvb_memdup(tvb, offset, captured_len);
|
||||
text = (guint8 *)tvb_g_memdup(tvb, offset, captured_len);
|
||||
|
||||
/* Perform CTR-mode transformation. */
|
||||
if (!ccm_ctr_encrypt(key, tmp, rx_mic, text, captured_len)) {
|
||||
|
|
|
@ -505,7 +505,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if ((plen + hlen) == tvb_length(tvb)) {
|
||||
/* Need to integrate the last nibble */
|
||||
guint8 *data = (guint8 *)tvb_memdup(tvb, hlen, plen);
|
||||
guint8 *data = (guint8 *)tvb_g_memdup(tvb, hlen, plen);
|
||||
data[plen-1] |= tvb_get_guint8(tvb, 2) << 4;
|
||||
payload = tvb_new_child_real_data(tvb, data, plen, plen);
|
||||
tvb_set_free_cb(payload, g_free);
|
||||
|
|
|
@ -1291,7 +1291,7 @@ char *mechanism = NULL;
|
|||
* different type and/or mechanism.
|
||||
*/
|
||||
if(!actx->pinfo->fd->flags.visited) {
|
||||
mechanism = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
|
||||
mechanism = tvb_get_g_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
|
||||
ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */
|
||||
/*
|
||||
* If the mechanism in this request is an empty string (which is
|
||||
|
|
|
@ -288,7 +288,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
digest_type = tvb_get_guint8 (tvb, 2);
|
||||
compression = tvb_get_guint8 (tvb, 3);
|
||||
cookie = tvb_get_ntohl (tvb, 4);
|
||||
digest = (guint8 *)tvb_memdup (tvb, 8, DIGEST_LEN);
|
||||
digest = (guint8 *)tvb_g_memdup (tvb, 8, DIGEST_LEN);
|
||||
size = tvb_get_ntoh64 (tvb, 40);
|
||||
offset = tvb_get_ntoh64 (tvb, 48);
|
||||
targetTime = tvb_get_ntohl (tvb, 56);
|
||||
|
@ -522,7 +522,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
FALSE);
|
||||
|
||||
/* Include new-line in line */
|
||||
line = (guint8 *)tvb_memdup(tvb, offset, linelen+1); /* XXX - memory leak? */
|
||||
line = (guint8 *)tvb_g_memdup(tvb, offset, linelen+1); /* XXX - memory leak? */
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_text(ldss_tree, tvb, offset, linelen,
|
||||
|
|
|
@ -1948,7 +1948,7 @@ static void dissect_mih_tlv(tvbuff_t *tvb,int offset, proto_tree *tlv_tree, guin
|
|||
|
||||
case VEND_SPECIFIC_TLV :
|
||||
/*Vendor specific tlv*/
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Vendor Specific TLV :%s", tvb_get_string(tvb, offset, length));
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Vendor Specific TLV :%s", tvb_get_g_string(tvb, offset, length));
|
||||
break;
|
||||
|
||||
default :/*did not match type*/
|
||||
|
@ -1956,15 +1956,15 @@ static void dissect_mih_tlv(tvbuff_t *tvb,int offset, proto_tree *tlv_tree, guin
|
|||
|
||||
/*RESERVED TLVs*/
|
||||
if(type > 63 && type < 100)
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Reserved TLV :%s", tvb_get_string(tvb, offset, length));
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Reserved TLV :%s", tvb_get_g_string(tvb, offset, length));
|
||||
|
||||
/*EXPERIMENTAL TLVs*/
|
||||
else if(type > 100 && type < 255)
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Experimental TLV :%s", tvb_get_string(tvb, offset, length));
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "Experimental TLV :%s", tvb_get_g_string(tvb, offset, length));
|
||||
|
||||
/*UNKNOWN TLVs*/
|
||||
else
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "UNKNOWN TLV :%s", tvb_get_string(tvb, offset, length));
|
||||
proto_tree_add_text(tlv_tree, tvb, offset, length, "UNKNOWN TLV :%s", tvb_get_g_string(tvb, offset, length));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -981,7 +981,7 @@ nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, i
|
|||
|
||||
if(parent_len){
|
||||
nns->parent_len=parent_len;
|
||||
nns->parent=(unsigned char *)tvb_memdup(tvb, parent_offset, parent_len);
|
||||
nns->parent=(unsigned char *)tvb_g_memdup(tvb, parent_offset, parent_len);
|
||||
} else {
|
||||
nns->parent_len=0;
|
||||
nns->parent=NULL;
|
||||
|
@ -1042,7 +1042,7 @@ nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
|
|||
}
|
||||
|
||||
/* oki, we have a new entry */
|
||||
fh=(unsigned char *)tvb_memdup(tvb, fh_offset, fh_length);
|
||||
fh=(unsigned char *)tvb_g_memdup(tvb, fh_offset, fh_length);
|
||||
nns->fh=fh;
|
||||
nns->fh_length=fh_length;
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of
|
|||
|
||||
fhlen=fh_length;
|
||||
/* align it */
|
||||
fhdata=(guint32 *)tvb_memdup(tvb, fh_offset, fh_length);
|
||||
fhdata=(guint32 *)tvb_g_memdup(tvb, fh_offset, fh_length);
|
||||
fhkey[0].length=1;
|
||||
fhkey[0].key=&fhlen;
|
||||
fhkey[1].length=fhlen/4;
|
||||
|
@ -2321,7 +2321,7 @@ dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
|
|||
guint8 *fh_array;
|
||||
proto_item *fh_item = NULL;
|
||||
|
||||
fh_array = tvb_get_string(tvb, offset, fhlen);
|
||||
fh_array = tvb_get_g_string(tvb, offset, fhlen);
|
||||
fhhash = crc32_ccitt(fh_array, fhlen);
|
||||
g_free(fh_array);
|
||||
|
||||
|
@ -7963,7 +7963,7 @@ dissect_nfs4_stateid(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 *hash)
|
|||
newftree = proto_item_add_subtree(fitem, ett_nfs4_stateid);
|
||||
}
|
||||
|
||||
sidh_array = tvb_get_string(tvb, offset, 16);
|
||||
sidh_array = tvb_get_g_string(tvb, offset, 16);
|
||||
sid_hash = crc16_ccitt(sidh_array, 16);
|
||||
g_free(sidh_array);
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ nlm_register_unmatched_msg(packet_info *pinfo, tvbuff_t *tvb, int offset)
|
|||
umd->req_frame=pinfo->fd->num;
|
||||
umd->ns=pinfo->fd->abs_ts;
|
||||
umd->cookie_len=tvb_get_ntohl(tvb, offset);
|
||||
umd->cookie=(const guint8 *)tvb_memdup(tvb, offset+4, umd->cookie_len);
|
||||
umd->cookie=(const guint8 *)tvb_g_memdup(tvb, offset+4, umd->cookie_len);
|
||||
|
||||
/* remove any old duplicates */
|
||||
old_umd=(nlm_msg_res_unmatched_data *)g_hash_table_lookup(nlm_msg_res_unmatched, (gconstpointer)umd);
|
||||
|
|
|
@ -2079,7 +2079,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
|
|||
|
||||
/* Store the decrypted contents in the packet state struct
|
||||
(of course at this point, they aren't decrypted yet) */
|
||||
packet_ntlmssp_info->decrypted_payload = (guint8 *)tvb_memdup(tvb, offset,
|
||||
packet_ntlmssp_info->decrypted_payload = (guint8 *)tvb_g_memdup(tvb, offset,
|
||||
encrypted_block_length);
|
||||
packet_ntlmssp_info->payload_len = encrypted_block_length;
|
||||
decrypted_payloads = g_slist_prepend(decrypted_payloads,
|
||||
|
@ -2589,7 +2589,7 @@ dissect_ntlmssp_encrypted_payload(tvbuff_t *data_tvb,
|
|||
|
||||
/* Store the decrypted contents in the packet state struct
|
||||
(of course at this point, they aren't decrypted yet) */
|
||||
packet_ntlmssp_info->decrypted_payload = tvb_memdup(data_tvb, offset,
|
||||
packet_ntlmssp_info->decrypted_payload = tvb_g_memdup(data_tvb, offset,
|
||||
encrypted_block_length);
|
||||
decrypted_payloads = g_slist_prepend(decrypted_payloads,
|
||||
packet_ntlmssp_info->decrypted_payload);
|
||||
|
|
|
@ -375,7 +375,7 @@ dissect_ppcap_destination_address(tvbuff_t *tvb, packet_info * pinfo, proto_tree
|
|||
else if (key2 == 4)
|
||||
{
|
||||
char *string;
|
||||
string = tvb_get_string(tvb, offset, msg_len);
|
||||
string = tvb_get_g_string(tvb, offset, msg_len);
|
||||
proto_tree_add_string(ppcap_tree1, hf_ppcap_destination_nodeid, tvb, offset, msg_len, string);
|
||||
TVB_SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, tvb, offset, msg_len);
|
||||
COPY_ADDRESS_SHALLOW(&pinfo->dst, &pinfo->net_dst);
|
||||
|
|
|
@ -4604,7 +4604,7 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
tvb_ensure_bytes_exist (tvb, 0, hdr_len); /* ip_hdr_len + 8 */
|
||||
|
||||
/* allocate a copy of the IP packet */
|
||||
ip_packet = (guchar *)tvb_memdup(tvb, 0, length);
|
||||
ip_packet = (guchar *)tvb_g_memdup(tvb, 0, length);
|
||||
|
||||
/* restore the proper values to the IP and UDP length fields */
|
||||
ip_packet[2] = length >> 8;
|
||||
|
|
|
@ -6593,7 +6593,7 @@ dissect_smb2_transform_header(packet_info *pinfo _U_, proto_tree *tree,
|
|||
|
||||
memcpy(&A_1[1], sti->nonce, 15 - 4);
|
||||
|
||||
plain_data = (guint8 *)tvb_memdup(tvb, offset, sti->size);
|
||||
plain_data = (guint8 *)tvb_g_memdup(tvb, offset, sti->size);
|
||||
|
||||
/* Open the cipher. */
|
||||
if (gcry_cipher_open(&cipher_hd, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, 0)) {
|
||||
|
|
|
@ -583,7 +583,7 @@ dissect_t124_T_value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pr
|
|||
|
||||
if(next_tvb) {
|
||||
|
||||
ns = tvb_get_string(t124NSIdentifier, 0, tvb_length(t124NSIdentifier));
|
||||
ns = tvb_get_g_string(t124NSIdentifier, 0, tvb_length(t124NSIdentifier));
|
||||
if(ns != NULL) {
|
||||
dissector_try_string(t124_ns_dissector_table, ns, next_tvb, actx->pinfo, top_tree);
|
||||
g_free(ns);
|
||||
|
|
|
@ -390,7 +390,7 @@ tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pin
|
|||
|
||||
tvb_memcpy(tvb, session_id, 4,4);
|
||||
|
||||
buff = (guint8 *)tvb_memdup(tvb, TAC_PLUS_HDR_SIZE, len);
|
||||
buff = (guint8 *)tvb_g_memdup(tvb, TAC_PLUS_HDR_SIZE, len);
|
||||
|
||||
|
||||
md5_xor( buff, key, len, session_id,version, tvb_get_guint8(tvb,2) );
|
||||
|
|
|
@ -1781,7 +1781,7 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo)
|
|||
tvb, offset, 2, codepage);
|
||||
offset += 2;
|
||||
} else if (hdr_id >= 0x20) { /* Textual header */
|
||||
/* Header name MUST be NUL-ended string ==> tvb_get_stringz() */
|
||||
/* Header name MUST be NUL-ended string ==> tvb_get_g_stringz() */
|
||||
hdr_str = (gchar *)tvb_get_ephemeral_stringz(tvb, hdr_start, (gint *)&hdr_len);
|
||||
val_start = hdr_start + hdr_len;
|
||||
val_id = tvb_get_guint8(tvb, val_start);
|
||||
|
|
|
@ -235,7 +235,7 @@ static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
|
|||
dissect_xml(tvb, pinfo, tree);
|
||||
return TRUE;
|
||||
} else if (pref_heuristic_unicode) {
|
||||
const guint8 *data_str = tvb_get_unicode_string(tvb, 0, tvb_length(tvb), ENC_LITTLE_ENDIAN);
|
||||
const guint8 *data_str = tvb_get_g_unicode_string(tvb, 0, tvb_length(tvb), ENC_LITTLE_ENDIAN);
|
||||
tvbuff_t *unicode_tvb = tvb_new_child_real_data(tvb, data_str, tvb_length(tvb)/2, tvb_length(tvb)/2);
|
||||
tvb_set_free_cb(unicode_tvb, g_free);
|
||||
if (tvbparse_peek(tvbparse_init(unicode_tvb, 0, -1, NULL, want_ignore), want_heur)) {
|
||||
|
|
|
@ -878,7 +878,7 @@ dissect_xtp_diag(tvbuff_t *tvb, proto_tree *tree, guint32 offset) {
|
|||
offset += 4;
|
||||
/* message(n) */
|
||||
msg_len = tvb_length_remaining(tvb, offset);
|
||||
diag->msg = tvb_get_string(tvb, offset, msg_len);
|
||||
diag->msg = tvb_get_g_string(tvb, offset, msg_len);
|
||||
|
||||
/** display **/
|
||||
offset = start;
|
||||
|
|
|
@ -1471,7 +1471,7 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
|
|||
*/
|
||||
if (length == -1) {
|
||||
/* This can throw an exception */
|
||||
string = tvb_get_stringz_enc(tvb, start, &length, encoding);
|
||||
string = tvb_get_g_stringz_enc(tvb, start, &length, encoding);
|
||||
} else if (length == 0) {
|
||||
string = "[Empty]";
|
||||
} else {
|
||||
|
|
|
@ -758,7 +758,7 @@ tvb_memcpy(tvbuff_t *tvb, void *target, const gint offset, size_t length)
|
|||
* meaning "to the end of the buffer"?
|
||||
*/
|
||||
void *
|
||||
tvb_memdup(tvbuff_t *tvb, const gint offset, size_t length)
|
||||
tvb_g_memdup(tvbuff_t *tvb, const gint offset, size_t length)
|
||||
{
|
||||
guint abs_offset, abs_length;
|
||||
void *duped;
|
||||
|
@ -1964,7 +1964,7 @@ tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const gint size)
|
|||
* Throws an exception if the tvbuff ends before the string does.
|
||||
*/
|
||||
guint8 *
|
||||
tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length)
|
||||
tvb_get_g_string(tvbuff_t *tvb, const gint offset, const gint length)
|
||||
{
|
||||
const guint8 *ptr;
|
||||
guint8 *strbuf = NULL;
|
||||
|
@ -1991,7 +1991,7 @@ tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length)
|
|||
* Returns an UTF-8 string that must be freed by the caller
|
||||
*/
|
||||
gchar *
|
||||
tvb_get_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding)
|
||||
tvb_get_g_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding)
|
||||
{
|
||||
gunichar2 uchar;
|
||||
gint i; /* Byte counter for tvbuff */
|
||||
|
@ -2187,7 +2187,7 @@ tvb_get_seasonal_string(tvbuff_t *tvb, const gint offset, const gint length)
|
|||
* string (including the terminating null) through a pointer.
|
||||
*/
|
||||
guint8 *
|
||||
tvb_get_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding)
|
||||
tvb_get_g_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding)
|
||||
{
|
||||
guint size;
|
||||
guint8 *strptr;
|
||||
|
@ -2203,9 +2203,9 @@ tvb_get_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint
|
|||
}
|
||||
|
||||
guint8 *
|
||||
tvb_get_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
|
||||
tvb_get_g_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
|
||||
{
|
||||
return tvb_get_stringz_enc(tvb, offset, lengthp, ENC_UTF_8|ENC_NA);
|
||||
return tvb_get_g_stringz_enc(tvb, offset, lengthp, ENC_UTF_8|ENC_NA);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2990,7 +2990,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
compr = (guint8 *)tvb_memdup(tvb, offset, comprlen);
|
||||
compr = (guint8 *)tvb_g_memdup(tvb, offset, comprlen);
|
||||
|
||||
if (!compr)
|
||||
return NULL;
|
||||
|
|
|
@ -338,8 +338,8 @@ guint8 *ep_tvb_get_bits(tvbuff_t *tvb, guint bit_offset, gint no_of_bits, gboole
|
|||
WS_DLL_PUBLIC void* tvb_memcpy(tvbuff_t*, void* target, const gint offset, size_t length);
|
||||
|
||||
/** It is the user's responsibility to g_free() the memory allocated by
|
||||
* tvb_memdup(). Calls tvb_memcpy() */
|
||||
WS_DLL_PUBLIC void* tvb_memdup(tvbuff_t*, const gint offset, size_t length);
|
||||
* tvb_g_memdup(). Calls tvb_memcpy() */
|
||||
WS_DLL_PUBLIC void* tvb_g_memdup(tvbuff_t*, const gint offset, size_t length);
|
||||
|
||||
/* Same as above but the buffer returned from this function does not have to
|
||||
* be freed. It will be automatically freed after the packet is dissected.
|
||||
|
@ -485,8 +485,8 @@ extern gchar *tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const
|
|||
* instead it will automatically be freed when a new capture
|
||||
* or file is opened.
|
||||
*/
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length);
|
||||
WS_DLL_PUBLIC gchar *tvb_get_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_g_string(tvbuff_t *tvb, const gint offset, const gint length);
|
||||
WS_DLL_PUBLIC gchar *tvb_get_g_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_ephemeral_string(tvbuff_t *tvb, const gint offset, const gint length);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_ephemeral_string_enc(tvbuff_t *tvb, const gint offset,
|
||||
const gint length, const guint encoding);
|
||||
|
@ -529,8 +529,8 @@ extern guint8 *tvb_get_seasonal_string(tvbuff_t *tvb, const gint offset, const g
|
|||
* instead it will automatically be freed when a new capture
|
||||
* or file is opened.
|
||||
*/
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_g_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_g_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding);
|
||||
WS_DLL_PUBLIC const guint8 *tvb_get_const_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_ephemeral_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
|
||||
WS_DLL_PUBLIC guint8 *tvb_get_ephemeral_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding);
|
||||
|
|
|
@ -116,7 +116,7 @@ composite_get_ptr(tvbuff_t *tvb, guint abs_offset, guint abs_length)
|
|||
return tvb_get_ptr(member_tvb, member_offset, abs_length);
|
||||
}
|
||||
else {
|
||||
tvb->real_data = (guint8 *)tvb_memdup(tvb, 0, -1);
|
||||
tvb->real_data = (guint8 *)tvb_g_memdup(tvb, 0, -1);
|
||||
return tvb->real_data + abs_offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
|
|||
Address eth = (Address)g_malloc(sizeof(address));
|
||||
eth->type = AT_ETHER;
|
||||
eth->len = fi->length;
|
||||
eth->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
eth->data = tvb_g_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
pushAddress(L,eth);
|
||||
return 1;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
|
|||
Address ipv4 = (Address)g_malloc(sizeof(address));
|
||||
ipv4->type = AT_IPv4;
|
||||
ipv4->len = fi->length;
|
||||
ipv4->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
ipv4->data = tvb_g_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
pushAddress(L,ipv4);
|
||||
return 1;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
|
|||
Address ipv6 = (Address)g_malloc(sizeof(address));
|
||||
ipv6->type = AT_IPv6;
|
||||
ipv6->len = fi->length;
|
||||
ipv6->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
ipv6->data = tvb_g_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
pushAddress(L,ipv6);
|
||||
return 1;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
|
|||
Address ipx = (Address)g_malloc(sizeof(address));
|
||||
ipx->type = AT_IPX;
|
||||
ipx->len = fi->length;
|
||||
ipx->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
ipx->data = tvb_g_memdup(fi->ds_tvb,fi->start,fi->length);
|
||||
pushAddress(L,ipx);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1024,7 +1024,7 @@ WSLUA_METHOD TvbRange_ether(lua_State* L) {
|
|||
|
||||
addr = g_new(address,1);
|
||||
|
||||
buff = (guint8 *)tvb_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len);
|
||||
buff = (guint8 *)tvb_g_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len);
|
||||
|
||||
SET_ADDRESS(addr, AT_ETHER, 6, buff);
|
||||
pushAddress(L,addr);
|
||||
|
|
Loading…
Reference in New Issue