summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-teamspeak2.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2013-04-09 21:16:29 +0000
committerMartin Kaiser <wireshark@kaiser.cx>2013-04-09 21:16:29 +0000
commit2b59da3ff5826c369cbadcef40418caffb686f5a (patch)
tree7c0b9d6fba19124a995da999b5c8ed605ebe7caa /epan/dissectors/packet-teamspeak2.c
parent83bee645657f7591077f75638c12faac3fa98def (diff)
downloadwireshark-2b59da3ff5826c369cbadcef40418caffb686f5a.tar.gz
Coverity CID 280299
check return value of tvb_reported_length_remaining() svn path=/trunk/; revision=48803
Diffstat (limited to 'epan/dissectors/packet-teamspeak2.c')
-rw-r--r--epan/dissectors/packet-teamspeak2.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-teamspeak2.c b/epan/dissectors/packet-teamspeak2.c
index 8a07e47ddc..38018d7947 100644
--- a/epan/dissectors/packet-teamspeak2.c
+++ b/epan/dissectors/packet-teamspeak2.c
@@ -822,12 +822,17 @@ static void dissect_ts2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* */
static gboolean ts2_add_checked_crc32(proto_tree *tree, int hf_item, tvbuff_t *tvb, guint16 offset, guint32 icrc32 )
{
- guint8 *zero;
- guint32 ocrc32;
+ guint8 *zero;
+ gint len;
+ guint32 ocrc32;
+
zero = (guint8 *)ep_alloc0(4);
ocrc32 = crc32_ccitt_tvb(tvb, offset);
ocrc32 = crc32_ccitt_seed(zero, 4, 0xffffffff-ocrc32);
- ocrc32 = crc32_ccitt_tvb_offset_seed(tvb, offset+4, tvb_reported_length_remaining(tvb, offset+4), 0xffffffff-ocrc32);
+ len = tvb_reported_length_remaining(tvb, offset+4);
+ if (len<0)
+ return FALSE;
+ ocrc32 = crc32_ccitt_tvb_offset_seed(tvb, offset+4, (guint)len, 0xffffffff-ocrc32);
if(icrc32==ocrc32)
{
proto_tree_add_uint_format(tree, hf_item, tvb, offset, 4, tvb_get_letohl(tvb, 16), "crc32: 0x%04x [correct]", tvb_get_letohl(tvb, offset));