tvb_get_ptr + wmem_alloc = tvb_memdup

Change-Id: Iee33c59d5b032f3c99ba16338195c050e8078329
Reviewed-on: https://code.wireshark.org/review/15472
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2016-05-16 22:20:52 -04:00 committed by Anders Broman
parent ad02d79b36
commit fe187b630e
2 changed files with 2 additions and 4 deletions

View File

@ -2731,8 +2731,7 @@ static int dissect_2008_16_security_6_1(tvbuff_t *tvb, packet_info *pinfo, proto
{
return_data->security_mode = tvb_get_ntohs(start, 1);
return_data->security_mode_data_length = block_length - 4;
return_data->security_mode_data = (guint8 *)wmem_alloc0(wmem_file_scope(), block_length - 4);
memcpy(return_data->security_mode_data, tvb_get_ptr(start, 4, block_length - 4), block_length - 4);
return_data->security_mode_data = (guint8 *)tvb_memdup(wmem_file_scope(), start, 4, block_length - 4);
}
}

View File

@ -3935,10 +3935,9 @@ static int vvalue_tvb_blob(tvbuff_t *tvb, int offset, void *val)
{
struct data_blob *blob = (struct data_blob*)val;
guint32 len = tvb_get_letohl(tvb, offset);
const guint8 *data = tvb_get_ptr(tvb, offset + 4, len);
blob->size = len;
blob->data = (guint8*)wmem_memdup(wmem_packet_scope(), data, len);
blob->data = (guint8*)tvb_memdup(wmem_packet_scope(), tvb, offset + 4, len);
return 4 + len;
}