aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-07-11 10:29:26 +0200
committerAnders Broman <a.broman58@gmail.com>2016-07-11 09:21:52 +0000
commitdeaac110db74ad6de7b3d7a6416d1b0df7c51fe1 (patch)
tree1ef20302eae0f33c064f49dd6c4eba25abf2e419
parentf2584b230a80137343c3fc96c0052164ea9adfd4 (diff)
iso7816: check for minimum atr len
and reject the packet if it is shorter make sure that we don't throw an exception when we read the first byte and haven't yet decided if the packet contains an iso7816 atr Change-Id: I7b4c93cc7c55489467b46241f07a1bb5ddfd927a Reviewed-on: https://code.wireshark.org/review/16377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-iso7816.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c
index c388bb2..b1ddeb8 100644
--- a/epan/dissectors/packet-iso7816.c
+++ b/epan/dissectors/packet-iso7816.c
@@ -300,9 +300,13 @@ dissect_iso7816_atr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
guint8 tb, tc, td, k=0;
gint tck_len;
+ /* we need at least the initial char TS and the format char T0 */
+ if (tvb_captured_length(tvb) < 2)
+ return 0; /* no ATR sequence */
+
init_char = tvb_get_guint8(tvb, offset);
if (init_char!=0x3B && init_char!=0x3F)
- return 0; /* no ATR sequence */
+ return 0;
proto_it = proto_tree_add_protocol_format(tree, proto_iso7816_atr,
tvb, 0, -1, "ISO 7816 ATR");