aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorismaelrti <ismael@rti.com>2021-10-14 17:38:37 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-10-19 19:47:24 +0000
commita1031afbff3924f298eec672c8ce5f168f713473 (patch)
treea7c96d6ef91df9eb8cd5fa4e6ea702345fd69fbb
parentc1c5db86b6b944a7b51ab68e3beb4de518b2ddbe (diff)
RTPS: ixed dissection of unions in user data.
Removed the type_id check when dissecting user data. That check avoids dissection in valid cases.
-rw-r--r--epan/dissectors/packet-rtps.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index f3327e841b..c4006e8205 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -2872,43 +2872,35 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
union_member_mapping * result = (union_member_mapping *)wmem_map_lookup(union_member_mappings, &(key));
if (result != NULL) {
- switch (result->member_type_id) {
- case RTI_CDR_TYPE_OBJECT_TYPE_KIND_ENUMERATION_TYPE:
- case RTI_CDR_TYPE_OBJECT_TYPE_KIND_INT_32_TYPE: {
- gint value = tvb_get_gint32(tvb, offset, encoding);
- offset += 4;
- key = type_id + value;
- result = (union_member_mapping *)wmem_map_lookup(union_member_mappings, &(key));
- if (result != NULL) {
- if (show) {
- proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" G_GINT64_MODIFIER "x)",
- value, result->member_type_id);
- }
- offset = dissect_user_defined(tree, tvb, offset, encoding, NULL,
- result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
- } else {
- /* the hashmap uses the type_id to index the objects. substracting -2 here to lookup the discriminator
- related to the type_id that identifies an union */
- key = type_id + HASHMAP_DISCRIMINATOR_CONSTANT;
- result = (union_member_mapping *)wmem_map_lookup(union_member_mappings, &(key));
- if (result != NULL) {
- if (show) {
- proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" G_GINT64_MODIFIER "x)",
- value, result->member_type_id);
- }
- offset = dissect_user_defined(tree, tvb, offset, encoding, NULL,
- result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
- }
+ gint value = tvb_get_gint32(tvb, offset, encoding);
+ offset += 4;
+ key = type_id + value;
+ result = (union_member_mapping *)wmem_map_lookup(union_member_mappings, &(key));
+ if (result != NULL) {
+ if (show) {
+ proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" G_GINT64_MODIFIER "x)",
+ value, result->member_type_id);
+ }
+ offset = dissect_user_defined(tree, tvb, offset, encoding, NULL,
+ result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
+ } else {
+ /* the hashmap uses the type_id to index the objects. substracting -2 here to lookup the discriminator
+ related to the type_id that identifies an union */
+ key = type_id + HASHMAP_DISCRIMINATOR_CONSTANT;
+ result = (union_member_mapping *)wmem_map_lookup(union_member_mappings, &(key));
+ if (result != NULL) {
+ if (show) {
+ proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" G_GINT64_MODIFIER "x)",
+ value, result->member_type_id);
}
- break;
+ offset = dissect_user_defined(tree, tvb, offset, encoding, NULL,
+ result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
}
- default:
- break;
}
} else {
- if (show) {
- proto_item_append_text(tree, "(NULL 0x%016" G_GINT64_MODIFIER "x)", type_id);
- }
+ if (show) {
+ proto_item_append_text(tree, "(NULL 0x%016" G_GINT64_MODIFIER "x)", type_id);
+ }
}
break;
}