aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2003-09-10 21:19:47 +0000
committerGerald Combs <gerald@wireshark.org>2003-09-10 21:19:47 +0000
commit7704cdd1490ee9017ac78c03ca9728abdd2c20f9 (patch)
treebe02fa3d85f537c37c722cdfb087ccc2b11fa2ba /epan/tvbuff.c
parent4e21a36656caf0a4a75af2b9836e4eb23f161762 (diff)
downloadwireshark-7704cdd1490ee9017ac78c03ca9728abdd2c20f9.tar.gz
wireshark-7704cdd1490ee9017ac78c03ca9728abdd2c20f9.tar.bz2
wireshark-7704cdd1490ee9017ac78c03ca9728abdd2c20f9.zip
Make tvb_find_tvb() return -1 if either tvb length is 0. Otherwise, an
assertion happens 'xxxx contains ""'. svn path=/trunk/; revision=8450
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 65997123bc..d1e4e0970c 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.49 2003/08/27 15:23:02 gram Exp $
+ * $Id: tvbuff.c,v 1.50 2003/09/10 21:19:47 gerald Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
*
@@ -2152,6 +2152,10 @@ tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset)
const guint needle_len = needle_tvb->length;
const guint8 *location;
+ if (haystack_tvb->length < 1 || needle_tvb->length < 1) {
+ return -1;
+ }
+
/* Get pointers to the tvbuffs' data. */
haystack_data = tvb_get_ptr(haystack_tvb, 0, -1);
needle_data = tvb_get_ptr(needle_tvb, 0, -1);