aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorYoshihiro Ueda <uyoshihiro@users.noreply.gitlab.com>2020-12-06 12:47:04 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2020-12-09 11:28:10 +0000
commit9cee503a874ef8f10ef8c81334b5053536a1b761 (patch)
tree2f49c6798f51cbe582b784eb99ada214da74b71e /epan
parentb668d0a9d54cbd81c3ffe1391a9a54c541c39bf4 (diff)
SOME/IP: Fixed incorrect resetting offset of static array.
Fixed resetting offset of array to enable only when created tvb subset. Fixes #17057 (cherry picked from commit 2ab153527dd38ce3528b02ed25c89b54e1b4aa6c)
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-someip.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-someip.c b/epan/dissectors/packet-someip.c
index 2db77c1b1d..123d725f90 100644
--- a/epan/dissectors/packet-someip.c
+++ b/epan/dissectors/packet-someip.c
@@ -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;
}