SMPP: AT_STRINGZ address allocation must use the pinfo pool
Fixes an ASAN failure reported by Alexis Change-Id: I33b21d148e631e8a554882283a1c7284d701af1a Reviewed-on: https://code.wireshark.org/review/7409 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
29feae5f98
commit
bcf870e2af
|
@ -1245,16 +1245,15 @@ smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
|
||||||
(*offset) += len;
|
(*offset) += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE - caller must free the returned string! */
|
|
||||||
static const char *
|
static const char *
|
||||||
smpp_handle_string_return(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
|
smpp_handle_string_return(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int field, int *offset)
|
||||||
{
|
{
|
||||||
gint len;
|
gint len;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
len = tvb_strsize(tvb, *offset);
|
len = tvb_strsize(tvb, *offset);
|
||||||
if (len > 1) {
|
if (len > 1) {
|
||||||
str = (char *)tvb_get_stringz_enc(wmem_packet_scope(), tvb, *offset, &len, ENC_ASCII);
|
str = (char *)tvb_get_stringz_enc(pinfo->pool, tvb, *offset, &len, ENC_ASCII);
|
||||||
proto_tree_add_string(tree, field, tvb, *offset, len, str);
|
proto_tree_add_string(tree, field, tvb, *offset, len, str);
|
||||||
} else {
|
} else {
|
||||||
str = "";
|
str = "";
|
||||||
|
@ -1934,10 +1933,10 @@ submit_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
|
||||||
smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
|
smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)");
|
||||||
smpp_handle_int1(tree, tvb, hf_smpp_source_addr_ton, &offset);
|
smpp_handle_int1(tree, tvb, hf_smpp_source_addr_ton, &offset);
|
||||||
smpp_handle_int1(tree, tvb, hf_smpp_source_addr_npi, &offset);
|
smpp_handle_int1(tree, tvb, hf_smpp_source_addr_npi, &offset);
|
||||||
src_str = smpp_handle_string_return(tree, tvb, hf_smpp_source_addr, &offset);
|
src_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_source_addr, &offset);
|
||||||
smpp_handle_int1(tree, tvb, hf_smpp_dest_addr_ton, &offset);
|
smpp_handle_int1(tree, tvb, hf_smpp_dest_addr_ton, &offset);
|
||||||
smpp_handle_int1(tree, tvb, hf_smpp_dest_addr_npi, &offset);
|
smpp_handle_int1(tree, tvb, hf_smpp_dest_addr_npi, &offset);
|
||||||
dst_str = smpp_handle_string_return(tree, tvb, hf_smpp_destination_addr, &offset);
|
dst_str = smpp_handle_string_return(tree, tvb, pinfo, hf_smpp_destination_addr, &offset);
|
||||||
flag = tvb_get_guint8(tvb, offset);
|
flag = tvb_get_guint8(tvb, offset);
|
||||||
udhi = flag & 0x40;
|
udhi = flag & 0x40;
|
||||||
proto_tree_add_uint(tree, hf_smpp_esm_submit_msg_mode,
|
proto_tree_add_uint(tree, hf_smpp_esm_submit_msg_mode,
|
||||||
|
|
Loading…
Reference in New Issue