Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 7275] iso7816: dissect ATR (answer to reset)

Date: Tue, 22 May 2012 14:32:20 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7275

Pascal Quantin <pascal.quantin@xxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pascal.quantin@xxxxxxxxx

--- Comment #2 from Pascal Quantin <pascal.quantin@xxxxxxxxx> 2012-05-22 14:32:19 PDT ---
Hi Martin,

+        if (i==0) {
+            td_it = proto_tree_add_item(tree, hf_iso7816_atr_t0,
+                    tvb, offset, 1, ENC_BIG_ENDIAN);
+        }
+        else {
+            td_it = proto_tree_add_uint_format(tree, hf_iso7816_atr_td,
+                    tvb, offset, 1, td,
+                    "Interface character TD(%d): 0x%02x", i, td);
+        }
+        if (td_it)
+            td_tree = proto_item_add_subtree(td_it, ett_iso7816_atr_td);
+
+        proto_tree_add_boolean_format(td_tree, hf_iso7816_atr_next_ta_present,
+                tvb, offset, 1, td&0x10,
+                "TA(%d) present: %s", i+1, td&0x10 ? "True" : "False");

Why test explicitly that td_it is not null so as to define the subtree?
proto_item_add_subtree() is already checking it internally. Moreover afterwards
you are not checking td_tree value before using it.

checkhf.pl script finds 3 unused entries:
Unused entry: epan/dissectors//packet-iso7816.c, hf_iso7816_atr_ta
Unused entry: epan/dissectors//packet-iso7816.c, hf_iso7816_atr_tb
Unused entry: epan/dissectors//packet-iso7816.c, hf_iso7816_atr_tc

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.