diff options
author | Gerald Combs <gerald@wireshark.org> | 2019-12-12 11:47:26 -0800 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-12-12 20:23:09 +0000 |
commit | dd1daa41cd7fa9dc18cfa8696a60ad1c2a424de4 (patch) | |
tree | c7e80df41cd24e7f0b8d7fe8379ff72254556ace /epan/dissectors/packet-per.c | |
parent | 2629bd208168cf50205c9cb9d4d9e83043faa701 (diff) |
PER: Add a couple of NULL checks.
Check for NULLs in a couple of places found by scan-build. Fix a typo.
Change-Id: Idde75db6031fa9f2ffa36b7fa10b37bf676e0904
Reviewed-on: https://code.wireshark.org/review/35427
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-per.c')
-rw-r--r-- | epan/dissectors/packet-per.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 0183d852cd..2d2ef35586 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -1812,10 +1812,14 @@ index_get_extension_name(const per_sequence_t *sequence, int idx) static const char * index_get_field_name(const per_sequence_t *sequence, int idx) { - header_field_info *hfi; + if (sequence) { + header_field_info *hfi = proto_registrar_get_nth(*sequence[idx].p_id); - hfi = proto_registrar_get_nth(*sequence[idx].p_id); - return (hfi) ? hfi->name : "<unknown filed>"; + if (hfi) { + return hfi->name; + } + } + return "<unknown field>"; } /* this functions decodes a SEQUENCE @@ -1841,6 +1845,7 @@ dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree guint32 optional_mask[SEQ_MAX_COMPONENTS>>5]; DEBUG_ENTRY("dissect_per_sequence"); + DISSECTOR_ASSERT(sequence); item=proto_tree_add_item(parent_tree, hf_index, tvb, offset>>3, 0, ENC_BIG_ENDIAN); tree=proto_item_add_subtree(item, ett_index); |