aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2002-01-04 06:45:14 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2002-01-04 06:45:14 +0000
commita2251afaffd032b164031b0e3da422f525838cf0 (patch)
tree7898bdf8432dbd7ee15ede77bde712091c165554 /epan/tvbuff.c
parent9588f37fac2ce5036e524dad23247ed46b41f06f (diff)
Throw a BoundsError if a length parameter in a tvbuff-accessor is < -1.
svn path=/trunk/; revision=4474
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 549a6c90aa..d24643e243 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -9,7 +9,7 @@
* the data of a backing tvbuff, or can be a composite of
* other tvbuffs.
*
- * $Id: tvbuff.c,v 1.26 2001/11/20 22:46:12 guy Exp $
+ * $Id: tvbuff.c,v 1.27 2002/01/04 06:45:14 gram Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
*
@@ -407,8 +407,10 @@ compute_offset_length(tvbuff_t *tvb, gint offset, gint length,
}
/* Compute the length */
- g_assert(length >= -1);
- if (length == -1) {
+ if (length < -1) {
+ return FALSE;
+ }
+ else if (length == -1) {
*length_ptr = tvb->length - *offset_ptr;
}
else {
@@ -457,6 +459,10 @@ check_offset_length(tvbuff_t *tvb, gint offset, gint length,
{
int exception = 0;
+ if (length < -1) {
+ THROW(BoundsError);
+ }
+
if (!check_offset_length_no_exception(tvb, offset, length, offset_ptr, length_ptr, &exception)) {
g_assert(exception > 0);
THROW(exception);