diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-07-21 00:22:17 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-07-21 00:22:17 +0000 |
commit | 52896da39eefca930577d5b9574748ac9eb7f056 (patch) | |
tree | e57b0fc9f5e7ec3da8733d26cf76266417022b65 | |
parent | 206b6edb1bc1f53a90f985383dfda6f29399a476 (diff) |
Offsets in packets should be "int", not "guint8", unless there is an
*inviolable guarantee* that the offset will *never* be bigger than 255.
(The same applies for "guint16" and 65535.) Otherwise, you run the risk
of an infinite loop (packets are not guaranteed to be valid, nor are the
contents of capture files - and there's no guarantee that you're reading
a DOCSIS file if you've turned on the "force interpretation as DOCSIS"
flag.)
svn path=/trunk/; revision=5897
-rw-r--r-- | plugins/docsis/packet-docsis.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index bdbd6c8abe..29c8051355 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -2,7 +2,7 @@ * Routines for docsis dissection * Copyright 2002, Anand V. Narwani <anarwani@cisco.com> * - * $Id: packet-docsis.c,v 1.3 2002/07/20 23:19:20 guy Exp $ + * $Id: packet-docsis.c,v 1.4 2002/07/21 00:22:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -192,7 +192,7 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree) proto_tree *ehdr_tree; proto_item *it; guint8 ehdrlen; - guint8 pos; + int pos; guint8 type; guint8 len; guint8 mini_slots; @@ -203,7 +203,7 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree) it = proto_tree_add_text (tree, tvb, pos, ehdrlen, "Extended Header"); ehdr_tree = proto_item_add_subtree (it, ett_ehdr); - while (pos < (ehdrlen + 4)) + while (pos < (int)(ehdrlen + 4)) { proto_tree_add_item (ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, FALSE); proto_tree_add_item (ehdr_tree, hf_docsis_eh_len, tvb, pos, 1, FALSE); |