aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-04-15 20:19:45 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2016-04-15 19:32:21 +0000
commit3ee37d7629eb13a610374f205278ad78bfa38161 (patch)
tree378cd19ea01014bf919b87784cd58e552a9b85ec /epan
parent4400dcfdd2b12785d41399fb43fe73153a2813f3 (diff)
GSM: add a sanity check
Like the one added in gcfc47c1 Change-Id: Ieb6aaa406ad141502980d4447d5ee9f03044acbe Reviewed-on: https://code.wireshark.org/review/14930 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-gsm_a_common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c
index a58a30546a..c878a7c97e 100644
--- a/epan/dissectors/packet-gsm_a_common.c
+++ b/epan/dissectors/packet-gsm_a_common.c
@@ -2173,6 +2173,9 @@ de_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guin
proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
+ if (curr_offset - offset >= len) /* Sanity check */
+ return (curr_offset - offset);
+
if((oct & 0x07) == 3){
/* imeisv */
digit_str = tvb_bcd_dig_to_wmem_packet_str(tvb ,curr_offset , len - (curr_offset - offset), NULL, TRUE);