diff options
author | Evan Huus <eapache@gmail.com> | 2014-04-23 11:50:24 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-04-23 15:57:13 +0000 |
commit | fe195c0c978b4b92dc5a77daa6449a7f1314243d (patch) | |
tree | c975dc7d3eba3aeea979122888dd08e90df5ecb5 /epan/tvbuff.h | |
parent | be13690c3ce269f215040f8d91baf374d05100e8 (diff) |
Don't throw for offset at end of TVB with len -1.
g867a1827e7dc88896ee27a107eb35c4b3973d270 introduced a change to cleanup/fix
handling of bounds checks for -1 length fields, but it ended up guaranteeing a
throw for 0-length tvbs, which isn't good; we ought to be able to add 0-length
FT_PROTOCOL items at the very least.
Better names for the function than _cheat are welcome, but I want to shut up the
buildbot.
Change-Id: I24610f947d03dac32766e2a0ffa0ff7bcc74c3e8
Reviewed-on: https://code.wireshark.org/review/1303
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/tvbuff.h')
-rw-r--r-- | epan/tvbuff.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/epan/tvbuff.h b/epan/tvbuff.h index e68095759a..69563b495d 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -240,6 +240,12 @@ 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 |