forked from osmocom/wireshark
dec-dnart: use pinfo-scoped memory for addresses
They may be accessed during the print phase, at which point packet-scope memory has already been freed. Bug: 10724 Change-Id: Ifcf5fc0c0857614edf85349b12dfe605abf6fef7 Reviewed-on: https://code.wireshark.org/review/5497 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
e843c6797d
commit
a559f2a050
|
@ -350,12 +350,13 @@ dnet_ntoa(const guint8 *data)
|
|||
}
|
||||
|
||||
static void
|
||||
set_dnet_address(address *paddr_src, address *paddr_tgt)
|
||||
set_dnet_address(packet_info *pinfo, address *paddr_src, address *paddr_tgt)
|
||||
{
|
||||
if (paddr_tgt->type != AT_STRINGZ && paddr_src->type == AT_ETHER) {
|
||||
char *addr = dnet_ntoa((const guint8 *)paddr_src->data);
|
||||
if (addr != NULL)
|
||||
SET_ADDRESS(paddr_tgt, AT_STRINGZ, 1, addr);
|
||||
SET_ADDRESS(paddr_tgt, AT_STRINGZ, 1,
|
||||
wmem_strdup(pinfo->pool, addr));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,10 +377,10 @@ dissect_dec_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DEC DNA");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
set_dnet_address(&pinfo->dl_src, &pinfo->net_src);
|
||||
set_dnet_address(&pinfo->dl_src, &pinfo->src);
|
||||
set_dnet_address(&pinfo->dl_dst, &pinfo->net_dst);
|
||||
set_dnet_address(&pinfo->dl_dst, &pinfo->dst);
|
||||
set_dnet_address(pinfo, &pinfo->dl_src, &pinfo->net_src);
|
||||
set_dnet_address(pinfo, &pinfo->dl_src, &pinfo->src);
|
||||
set_dnet_address(pinfo, &pinfo->dl_dst, &pinfo->net_dst);
|
||||
set_dnet_address(pinfo, &pinfo->dl_dst, &pinfo->dst);
|
||||
|
||||
offset += 2;
|
||||
msg_flags = tvb_get_guint8(tvb, offset);
|
||||
|
|
Loading…
Reference in New Issue