diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2015-06-23 10:58:38 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-06-23 20:15:45 +0000 |
commit | d85a221cd31b72ea757c5ea7d54b58eb7db28180 (patch) | |
tree | a85e5ae4fd2a536fbc617b1b27f2418d300dab7c /epan/proto.c | |
parent | b216d266fca6e41e37e05c81a77414af561ad0e0 (diff) |
proto_tree_add_item_ret_(u)int: do the NULL check at the start
before hfinfo is actually used (coverity 1293631)
Change-Id: I270c30c4699cd6f831a38986e6c8024c2e9ef47a
Reviewed-on: https://code.wireshark.org/review/9061
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/proto.c b/epan/proto.c index fd95afaf47..edf6796278 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -2080,6 +2080,8 @@ gint32 *retval) field_info *new_fi; gint32 value; + DISSECTOR_ASSERT_HINT(hfinfo != NULL, "Not passed hfi!"); + switch (hfinfo->type){ case FT_INT8: case FT_INT16: @@ -2090,7 +2092,6 @@ gint32 *retval) DISSECTOR_ASSERT_NOT_REACHED(); } - DISSECTOR_ASSERT_HINT(hfinfo != NULL, "Not passed hfi!"); /* length validation for native number encoding caught by get_uint_value() */ /* length has to be -1 or > 0 regardless of encoding */ if (length < -1 || length == 0) @@ -2131,6 +2132,8 @@ guint32 *retval) field_info *new_fi; guint32 value; + DISSECTOR_ASSERT_HINT(hfinfo != NULL, "Not passed hfi!"); + switch (hfinfo->type){ case FT_UINT8: case FT_UINT16: @@ -2141,7 +2144,6 @@ guint32 *retval) DISSECTOR_ASSERT_NOT_REACHED(); } - DISSECTOR_ASSERT_HINT(hfinfo != NULL, "Not passed hfi!"); /* length validation for native number encoding caught by get_uint_value() */ /* length has to be -1 or > 0 regardless of encoding */ if (length < -1 || length == 0) |