BACapp: Fix a recusion check.

Make sure fAbstractSyntaxNType() always decrements its proto_depth on
exit. Fixes #18039.

Remove a no-longer-needed p_add_proto_data() call.
This commit is contained in:
Gerald Combs 2022-04-13 18:22:34 -07:00
parent 4e0cd3dbd2
commit b51a635bce
1 changed files with 5 additions and 4 deletions

View File

@ -9009,7 +9009,9 @@ fAbstractSyntaxNType(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
lastoffset = offset;
fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt);
if (tag_is_closing(tag_info)) { /* closing tag, but not for me */
if (depth <= 0) return offset;
if (depth <= 0) {
goto cleanup;
}
}
do_default_handling = FALSE;
@ -9756,6 +9758,8 @@ fAbstractSyntaxNType(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
}
if (offset <= lastoffset) break; /* nothing happened, exit loop */
}
cleanup:
recursion_depth = p_get_proto_depth(pinfo, proto_bacapp);
p_set_proto_depth(pinfo, proto_bacapp, recursion_depth - 1);
return offset;
@ -16369,9 +16373,6 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
bacinfo.instance_ident = NULL;
bacinfo.object_ident = NULL;
/* Recursion depth */
p_add_proto_data(pinfo->pool, pinfo, proto_bacapp, 0, GUINT_TO_POINTER(0));
switch (bacapp_type) {
case BACAPP_TYPE_CONFIRMED_SERVICE_REQUEST:
/* segmented messages have 2 additional bytes */