packetbb: Prevent divide by 0.

Bug: 12577
Change-Id: Ibfa605597b786d8dbf1e256ef2ca6dc691498974
Reviewed-on: https://code.wireshark.org/review/16241
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2016-07-02 08:23:34 -04:00
parent b78dd096f4
commit 94e97e45cf
1 changed files with 7 additions and 5 deletions

View File

@ -346,12 +346,14 @@ static int dissect_pbb_tlvblock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
}
else {
int i;
guint8 c = indexEnd - indexStart + 1;
tlvValue_tree = proto_item_add_subtree(tlvValue_item, ett_packetbb_tlv_value);
guint c = indexEnd - indexStart + 1;
if (c > 0) {
tlvValue_tree = proto_item_add_subtree(tlvValue_item, ett_packetbb_tlv_value);
for (i=indexStart; i<=indexEnd; i++) {
proto_tree_add_item(tlvValue_tree, hf_packetbb_tlv_multivalue, tvb, offset, length/c, ENC_NA);
offset += (length/c);
for (i=indexStart; i<=indexEnd; i++) {
proto_tree_add_item(tlvValue_tree, hf_packetbb_tlv_multivalue, tvb, offset, length/c, ENC_NA);
offset += (length/c);
}
}
}
}