diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2012-05-25 00:29:46 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2012-05-25 00:29:46 +0000 |
commit | 8fd9342f7dbfe88883f7a5122ab68bf439c9d9f5 (patch) | |
tree | ba7a2f8b11ba5058611806f3e2d4863a5ea77d81 /asn1/c1222 | |
parent | 0c491764115161bfd8597c9bf0c9050b63493da0 (diff) |
tvb_length_remaining() can return a negative number, so be sure to handle it. Fixes Coverity CID 281367.
svn path=/trunk/; revision=42840
Diffstat (limited to 'asn1/c1222')
-rw-r--r-- | asn1/c1222/packet-c1222-template.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/asn1/c1222/packet-c1222-template.c b/asn1/c1222/packet-c1222-template.c index 1799cde92a..ea4b0f10be 100644 --- a/asn1/c1222/packet-c1222-template.c +++ b/asn1/c1222/packet-c1222-template.c @@ -887,6 +887,8 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ /* mode is ciphertext with authentication */ hasmac = TRUE; len2 = tvb_length_remaining(tvb, offset); + if (len2 <= 0) + return offset; encrypted = TRUE; if (c1222_decrypt) { buffer = tvb_memdup(tvb, offset, len2); @@ -906,6 +908,8 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ /* mode is cleartext with authentication */ hasmac = TRUE; len2 = tvb_length_remaining(tvb, offset); + if (len2 <= 0) + return offset; buffer = tvb_memdup(tvb, offset, len2); epsem_buffer = tvb_new_subset(tvb, offset, -1, -1); if (c1222_decrypt) { |