diff options
author | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-10-25 21:00:34 +0000 |
---|---|---|
committer | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-10-25 21:00:34 +0000 |
commit | 46deb56891129f9d8af9729ef2c52c2926fca881 (patch) | |
tree | 84eae635630e50619874af9059e68dbd9516675e /packet-gnutella.c | |
parent | ee752c2fe739b43188c61adeca01a8706d6e4843 (diff) |
Guard against 'size' being too small; the value comes from the packet,
so it can be corrupt.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4079 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-gnutella.c')
-rw-r--r-- | packet-gnutella.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/packet-gnutella.c b/packet-gnutella.c index 7557563be2..fff23a27c5 100644 --- a/packet-gnutella.c +++ b/packet-gnutella.c @@ -2,7 +2,7 @@ * Routines for gnutella dissection * Copyright 2001, B. Johannessen <bob@havoq.com> * - * $Id: packet-gnutella.c,v 1.3 2001/08/18 07:59:33 guy Exp $ + * $Id: packet-gnutella.c,v 1.4 2001/10/25 21:00:34 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -178,12 +178,21 @@ static void dissect_gnutella_query(tvbuff_t *tvb, int offset, proto_tree *tree, GNUTELLA_SHORT_LENGTH, min_speed); - proto_tree_add_item(tree, - hf_gnutella_query_search, - tvb, - offset + GNUTELLA_QUERY_SEARCH_OFFSET, - size - GNUTELLA_SHORT_LENGTH, - FALSE); + if (size > GNUTELLA_SHORT_LENGTH) { + proto_tree_add_item(tree, + hf_gnutella_query_search, + tvb, + offset + GNUTELLA_QUERY_SEARCH_OFFSET, + size - GNUTELLA_SHORT_LENGTH, + FALSE); + } + else { + proto_tree_add_text(tree, + tvb, + offset + GNUTELLA_QUERY_SEARCH_OFFSET, + 0, + "Missing data for Query Search."); + } } static void dissect_gnutella_queryhit(tvbuff_t *tvb, int offset, proto_tree *tree, int size) { |