tvbuff_composite.c: fix composite_get_ptr when length is over 2 segments

When storing a copy of the composite tvb in tvb->real_data, ensure to copy the full
data and not only the length currently requested by the call to tvb_get_ptr()

Change-Id: I6b42f3d46c4fba83fadf4d06f465c8d2486f4853
Reviewed-on: https://code.wireshark.org/review/18806
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2016-11-13 22:05:01 +01:00
parent a9626210f1
commit 4fd9872d11
1 changed files with 2 additions and 2 deletions

View File

@ -113,8 +113,8 @@ composite_get_ptr(tvbuff_t *tvb, guint abs_offset, guint abs_length)
}
else {
/* Use a temporary variable as tvb_memcpy is also checking tvb->real_data pointer */
void *real_data = g_malloc(abs_length);
tvb_memcpy(tvb, real_data, 0, abs_length);
void *real_data = g_malloc(tvb->length);
tvb_memcpy(tvb, real_data, 0, tvb->length);
tvb->real_data = (const guint8 *)real_data;
return tvb->real_data + abs_offset;
}