aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lmp.c
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2014-08-13 14:33:34 +0200
committerJörg Mayer <jmayer@loplof.de>2014-08-13 12:34:53 +0000
commit9e560bc3f0317b931a0ca08fded42f1035895c2f (patch)
treee591173d1816e8594db8d679e31b4868b6eceda9 /epan/dissectors/packet-lmp.c
parent633f1562ad2d8270c2710d1c6611362b3a516615 (diff)
Fix warning when compiling with -O3
/home/jmayer/work/wireshark/git/epan/dissectors/packet-lmp.c: In function ‘dissect_lmp’: /home/jmayer/work/wireshark/git/epan/dissectors/packet-lmp.c:776:13: error: array subscript is below array bounds [-Werror=array-bounds] ti = proto_tree_add_item(lmp_tree, ^ Change-Id: Ie949b4280f71a8f9f480a8e1d6592098ee7e67b5 Reviewed-on: https://code.wireshark.org/review/3573 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'epan/dissectors/packet-lmp.c')
-rw-r--r--epan/dissectors/packet-lmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c
index 8774cc17cd..b6abbcfb7c 100644
--- a/epan/dissectors/packet-lmp.c
+++ b/epan/dissectors/packet-lmp.c
@@ -761,6 +761,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
guint8 lmp_class;
guint8 type;
guint8 negotiable;
+ int filter_num;
const char *object_type;
obj_length = tvb_get_ntohs(tvb, offset+2);
@@ -771,10 +772,10 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
hidden_item = proto_tree_add_uint(lmp_tree, hf_lmp_filter[LMPF_OBJECT], tvb,
offset, 1, lmp_class);
PROTO_ITEM_SET_GENERATED(hidden_item);
- if (lmp_valid_class(lmp_class)) {
-
+ filter_num = lmp_class_to_filter_num(lmp_class);
+ if (filter_num != -1 && lmp_valid_class(lmp_class)) {
ti = proto_tree_add_item(lmp_tree,
- hf_lmp_filter[lmp_class_to_filter_num(lmp_class)],
+ hf_lmp_filter[filter_num],
tvb, offset, obj_length, ENC_NA); /* all possibilities are FT_NONE */
} else {
expert_add_info_format(pinfo, hidden_item, &ei_lmp_invalid_class,