summaryrefslogtreecommitdiff
path: root/epan/tvbuff_composite.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-11-13 22:05:01 +0100
committerPascal Quantin <pascal.quantin@gmail.com>2016-11-13 22:30:57 +0000
commit4fd9872d11d3d575d8f261097c51a7d30b36ee40 (patch)
treedf4ad25ed338c1775823a5c49f4883d4ccbf880d /epan/tvbuff_composite.c
parenta9626210f165aa9b9d4a3668ecfeb70784bd087f (diff)
downloadwireshark-4fd9872d11d3d575d8f261097c51a7d30b36ee40.tar.gz
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>
Diffstat (limited to 'epan/tvbuff_composite.c')
-rw-r--r--epan/tvbuff_composite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/tvbuff_composite.c b/epan/tvbuff_composite.c
index 1926a3e626..a7b9b7c347 100644
--- a/epan/tvbuff_composite.c
+++ b/epan/tvbuff_composite.c
@@ -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;
}