From b610734a12a4fbdfddfa777c7444d6896b94093f Mon Sep 17 00:00:00 2001 From: Chris Maynard Date: Sat, 12 Oct 2013 18:13:26 +0000 Subject: If the offset is out of bounds, have tvb_length_remaining() and tvb_reported_length_remaining() return 0 instead of -1. This should provide a better long-term fix for bugs/problems such as seen in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9263. In the long-run, if we like this behavior, we can change the return value to a guint as well. Let's let it simmer for awhile first ... svn path=/trunk/; revision=52571 --- epan/tvbuff.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'epan/tvbuff.h') diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 0646fcef38..7fef12da6b 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -221,8 +221,8 @@ WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t* tvb); WS_DLL_PUBLIC guint tvb_length(const tvbuff_t*); /** Computes bytes to end of buffer, from offset (which can be negative, - * to indicate bytes from end of buffer). Function returns -1 to - * indicate that offset is out of bounds. No exception is thrown. */ + * to indicate bytes from end of buffer). Function returns 0 if offset is out + * of bounds. No exception is thrown. */ WS_DLL_PUBLIC gint tvb_length_remaining(const tvbuff_t*, const gint offset); /** Same as above, but throws an exception if the offset is out of bounds. */ @@ -244,8 +244,7 @@ WS_DLL_PUBLIC guint tvb_reported_length(const tvbuff_t*); /** Computes bytes of reported packet data to end of buffer, from offset * (which can be negative, to indicate bytes from end of buffer). Function - * returns -1 to indicate that offset is out of bounds. No exception is - * thrown. */ + * returns 0 if offset is out of bounds. No exception is thrown. */ WS_DLL_PUBLIC gint tvb_reported_length_remaining(const tvbuff_t *tvb, const gint offset); /** Set the reported length of a tvbuff to a given value; used for protocols -- cgit v1.2.3