diff options
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 676cfe4f42..7e2ca93a65 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -870,6 +870,9 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) guint u_offset; DISSECTOR_ASSERT(tvb && tvb->initialized); + /* We don't check for overflow in this fast path so we only handle simple types */ + DISSECTOR_ASSERT(length <= 8); + if (offset < 0 || !tvb->real_data) { return ensure_contiguous(tvb, offset, length); } @@ -877,8 +880,6 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) u_offset = offset; end_offset = u_offset + length; - /* don't need to check for overflow because length <= 8 */ - if (end_offset <= tvb->length) { return tvb->real_data + u_offset; } @@ -888,7 +889,7 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) } THROW(BoundsError); /* not reached */ - return 0; + return NULL; } |