Replace tvb_get_ptr with tvb_memdup.

The number of bytes allocated is small enough not to matter.

Change-Id: I44c2103a87bd41f21e61d0f27648266fdc2be557
Reviewed-on: https://code.wireshark.org/review/15470
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2016-05-16 22:17:33 -04:00
parent cf66bdb42f
commit 6614f38091
2 changed files with 3 additions and 3 deletions

View File

@ -1494,7 +1494,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
multicast address nor an all-zero address and if sender IP address
isn't all zeroes. */
ip = tvb_get_ipv4(tvb, spa_offset);
mac = tvb_get_ptr(tvb, sha_offset, 6);
mac = (const guint8*)tvb_memdup(wmem_packet_scope(), tvb, sha_offset, 6);
if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0)
{
if (global_arp_register_network_address_binding)
@ -1518,7 +1518,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
ip = tvb_get_ipv4(tvb, tpa_offset);
mac = tvb_get_ptr(tvb, tha_offset, 6);
mac = (const guint8*)tvb_memdup(wmem_packet_scope(), tvb, tha_offset, 6);
if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0
&& ar_op != ARPOP_REQUEST)
{

View File

@ -1524,7 +1524,7 @@ dissect_atm_cell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* FF: parse the Header Error Check (HEC).
*/
ti = proto_tree_add_item(atm_tree, hf_atm_header_error_check, tvb, 4, 1, ENC_BIG_ENDIAN);
err = get_header_err(tvb_get_ptr(tvb, 0, 5));
err = get_header_err((const guint8*)tvb_memdup(wmem_packet_scope(), tvb, 0, 5));
if (err == NO_ERROR_DETECTED)
proto_item_append_text(ti, " (correct)");
else if (err == UNCORRECTIBLE_ERROR)