forked from osmocom/wireshark
When allocating address structures, use wmem_new0().
For structures used as the data in an address, use wmem_new(), so that structure padding is zeroed out; the comparison code for addresses compares all bytes of the structure for addresses that are structures, and the hashing code for hash tables using addresses as keys hash all the bytes, so we have to make sure that, for addresses that are the same, *all* bytes are the same. Change-Id: I995fd26cc2f20edb5a599f95562b720561708e57 Reviewed-on: https://code.wireshark.org/review/6517 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
b204ff4846
commit
f90eeb1775
|
@ -1377,8 +1377,8 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
|
|||
guint8 type;
|
||||
proto_tree *ddp_tree = NULL;
|
||||
proto_item *ti, *hidden_item;
|
||||
struct atalk_ddp_addr *src = wmem_new(pinfo->pool, struct atalk_ddp_addr),
|
||||
*dst = wmem_new(pinfo->pool, struct atalk_ddp_addr);
|
||||
struct atalk_ddp_addr *src = wmem_new0(pinfo->pool, struct atalk_ddp_addr),
|
||||
*dst = wmem_new0(pinfo->pool, struct atalk_ddp_addr);
|
||||
tvbuff_t *new_tvb;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
|
||||
|
@ -1438,8 +1438,8 @@ dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
e_ddp ddp;
|
||||
proto_tree *ddp_tree;
|
||||
proto_item *ti, *hidden_item;
|
||||
struct atalk_ddp_addr *src = wmem_new(pinfo->pool, struct atalk_ddp_addr),
|
||||
*dst = wmem_new(pinfo->pool, struct atalk_ddp_addr);
|
||||
struct atalk_ddp_addr *src = wmem_new0(pinfo->pool, struct atalk_ddp_addr),
|
||||
*dst = wmem_new0(pinfo->pool, struct atalk_ddp_addr);
|
||||
tvbuff_t *new_tvb;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
|
||||
|
|
|
@ -1915,7 +1915,7 @@ dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
|
||||
|
||||
/* Addresses in FID 4 are discontiguous, sigh */
|
||||
dst = wmem_new(pinfo->pool, struct sna_fid_type_4_addr);
|
||||
dst = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
|
||||
dst->saf = dsaf;
|
||||
dst->ef = def;
|
||||
SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, dst);
|
||||
|
@ -1925,7 +1925,7 @@ dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
|
||||
|
||||
/* Addresses in FID 4 are discontiguous, sigh */
|
||||
src = wmem_new(pinfo->pool, struct sna_fid_type_4_addr);
|
||||
src = wmem_new0(pinfo->pool, struct sna_fid_type_4_addr);
|
||||
src->saf = osaf;
|
||||
src->ef = oef;
|
||||
SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN, src);
|
||||
|
|
|
@ -3111,8 +3111,8 @@ usb_set_addr(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint16 bus_id
|
|||
int endpoint, gboolean req)
|
||||
{
|
||||
proto_item *sub_item;
|
||||
usb_address_t *src_addr = wmem_new(pinfo->pool, usb_address_t),
|
||||
*dst_addr = wmem_new(pinfo->pool, usb_address_t);
|
||||
usb_address_t *src_addr = wmem_new0(pinfo->pool, usb_address_t),
|
||||
*dst_addr = wmem_new0(pinfo->pool, usb_address_t);
|
||||
guint8 *str_src_addr;
|
||||
guint8 *str_dst_addr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue