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:
Evan Huus 2014-11-25 20:27:07 -05:00
parent e843c6797d
commit a559f2a050
1 changed files with 7 additions and 6 deletions

View File

@ -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);