aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-07-09 21:52:03 +0000
committerGuy Harris <guy@alum.mit.edu>2004-07-09 21:52:03 +0000
commit50ac5816130cde1d821259d2c4215a9b10e3d3a7 (patch)
treeb34ac9811a4eef3cdcff5631852b1e082738e529
parent70e22b4aba117e308045d0de820fea814bceb7d8 (diff)
"length" is relative to the start of the field, so don't subtract the
start of the field from it. svn path=/trunk/; revision=11354
-rw-r--r--epan/proto.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/epan/proto.c b/epan/proto.c
index f04f74398e..1cc57e6f6c 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.135 2004/07/05 16:42:19 ulfl Exp $
+ * $Id: proto.c,v 1.136 2004/07/09 21:52:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -3706,7 +3706,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
int abbrev_len;
char *buf, *stringified, *format, *ptr;
int dfilter_len, i;
- gint start, length;
+ gint start, length, length_remaining;
guint8 c;
hfinfo = finfo->hfinfo;
@@ -3891,8 +3891,9 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
/*
* Don't go past the end of that tvbuff.
*/
- if ((gint)length > tvb_length_remaining(finfo->ds_tvb, finfo->start))
- length = tvb_length_remaining(finfo->ds_tvb, finfo->start);
+ length_remaining = tvb_length_remaining(finfo->ds_tvb, finfo->start);
+ if (length > length_remaining)
+ length = length_remaining;
if (length <= 0)
return NULL;
@@ -3903,7 +3904,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
sprintf(ptr, "frame[%d:%d] == ", finfo->start, length);
ptr = buf+strlen(buf);
- for (i=0;i<length-finfo->start; i++) {
+ for (i=0;i<length; i++) {
c = tvb_get_guint8(finfo->ds_tvb, start);
start++;
if (i == 0 ) {