SOME/IP: Fixed incorrect resetting offset of static array.

Fixed resetting offset of array to enable only when created tvb subset. Fixes #17057
This commit is contained in:
Yoshihiro Ueda 2020-12-06 21:47:04 +09:00 committed by Wireshark GitLab Utility
parent 0af60377b4
commit 2ab153527d
1 changed files with 8 additions and 3 deletions

View File

@ -2271,6 +2271,8 @@ dissect_someip_payload_array_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tr
if (length != -1) {
if (length <= tvb_captured_length_remaining(tvb, offset)) {
subtvb = tvb_new_subset_length_caplen(tvb, offset, length, length);
/* created subtvb. so we set offset=0 */
offset = 0;
} else {
expert_someip_payload_truncated(tree, pinfo, tvb, offset, tvb_captured_length_remaining(tvb, offset));
return tvb_captured_length_remaining(tvb, offset);
@ -2279,8 +2281,6 @@ dissect_someip_payload_array_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tr
subtvb = tvb;
}
/* created subtvb. so we set offset=0 */
offset = 0;
while ((length == -1 && count < upper_limit) || ((gint)(8 * offset + offset_bits) < 8 * length)) {
bits_parsed = dissect_someip_payload_parameter(subtvb, pinfo, tree, offset, offset_bits, (guint8)config->data_type, config->id_ref, config->name);
if (bits_parsed == 0) {
@ -2297,7 +2297,12 @@ dissect_someip_payload_array_payload(tvbuff_t* tvb, packet_info* pinfo, proto_tr
col_append_str(pinfo->cinfo, COL_INFO, " [SOME/IP Payload: Dynamic array does not stay between Min and Max values]");
}
ret = 8 * offset + offset_bits;
if (length != -1) {
ret = 8 * offset + offset_bits;
} else {
ret = 8 * (offset - offset_orig) + offset_bits;
}
return ret;
}