summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-04-25 17:32:57 -0700
committerGuy Harris <guy@alum.mit.edu>2016-04-26 00:34:15 +0000
commit7b2d8a16c58b9a6a826f2df0f95a5504750493ed (patch)
tree78a8acdde9c7fa4173a2d80fa3b2757c96da5a74 /epan
parent83a547682b8a7d031ac3a23600607e81b4891a14 (diff)
downloadwireshark-7b2d8a16c58b9a6a826f2df0f95a5504750493ed.tar.gz
Always call test_length(), even if the tree is null.
Otherwise, we run the risk of getting caught in a loop that runs past the end of the packet. Shows up in, for example, the capture in bug 12370; if you read it with tshark -V, it reports malformed packets, but if you try to read it with tshark without -V, it spins. Bug: 12370 Change-Id: Ic3e7be2ddbaaf52b58c4f73348a0f093979af1cc Reviewed-on: https://code.wireshark.org/review/15115 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r--epan/proto.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 61ca5d2237..7dd5ccaf54 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -2441,6 +2441,7 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
offset = ptvc->offset;
PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo);
get_hfi_length(hfinfo, ptvc->tvb, offset, &length, &item_length);
+ test_length(hfinfo, ptvc->tvb, offset, item_length);
if (!ptvc->tree) {
ptvc->offset += get_full_length(hfinfo, ptvc->tvb, offset,
@@ -2454,8 +2455,6 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
ptvc->offset += get_full_length(hfinfo, ptvc->tvb, offset, length,
item_length, encoding);
- test_length(hfinfo, ptvc->tvb, offset, item_length);
-
/* Coast clear. Try and fake it */
TRY_TO_FAKE_THIS_ITEM(ptvc->tree, hfindex, hfinfo);