From a1b939313f75220beaf0d3342cd5f413cb9edcae Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Wed, 14 May 2014 13:00:37 -0400 Subject: Revert "Don't throw for offset at end of TVB with len -1." This reverts commit fe195c0c978b4b92dc5a77daa6449a7f1314243d. Conflicts: epan/tvbuff.c Change-Id: I1af618d0bd1e6211281b6d67c0ad197cfa513a0c Reviewed-on: https://code.wireshark.org/review/1639 Reviewed-by: Evan Huus --- epan/proto.c | 2 +- epan/tvbuff.c | 18 ------------------ epan/tvbuff.h | 6 ------ 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/epan/proto.c b/epan/proto.c index c82e6475a8..f2544e4016 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -3862,7 +3862,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint * of the tvbuff: we throw an exception in that * case. */ - *length = tvb_ensure_captured_length_remaining_cheat(tvb, start); + *length = tvb_ensure_captured_length_remaining(tvb, start); DISSECTOR_ASSERT(*length >= 0); break; diff --git a/epan/tvbuff.c b/epan/tvbuff.c index a6ab643fcf..be7f1403e5 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -457,24 +457,6 @@ tvb_captured_length_remaining(const tvbuff_t *tvb, const gint offset) return rem_length; } -/* Just like tvb_ensure_captured_length_remaining except it doesn't have to - * guarantee that at least one byte is available, it simply guarantees that the - * offset exists (so a 0 offset in a 0-length tvb won't throw) */ -guint -tvb_ensure_captured_length_remaining_cheat(const tvbuff_t *tvb, const gint offset) -{ - guint abs_offset, rem_length; - int exception = 0; - - DISSECTOR_ASSERT(tvb && tvb->initialized); - - COMPUTE_OFFSET_AND_REMAINING(tvb, offset, &abs_offset, rem_length, exception); - if (exception) - THROW(exception); - - return rem_length; -} - guint tvb_ensure_captured_length_remaining(const tvbuff_t *tvb, const gint offset) { diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 69563b495d..e68095759a 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -240,12 +240,6 @@ WS_DLL_PUBLIC gint tvb_captured_length_remaining(const tvbuff_t *tvb, const gint WS_DLL_PUBLIC guint tvb_ensure_captured_length_remaining(const tvbuff_t *tvb, const gint offset); -/** Same as above, but permits offsets at the end of the tvbuff (such as an - * offset of 0 in a tvbuff with a snapshot length of 0, which is a silly thing - * to do but we have to be able to handle it gracefully). */ -WS_DLL_PUBLIC guint tvb_ensure_captured_length_remaining_cheat( - const tvbuff_t *tvb, const gint offset); - /* DEPRECATED, do not use in new code, call tvb_ensure_captured_length_remaining directly! */ #define tvb_ensure_length_remaining tvb_ensure_captured_length_remaining -- cgit v1.2.3