From: Arran Cudbard-Bell Date: Wed, 30 Apr 2025 18:37:42 +0000 (-0400) Subject: Initialise break/return depth to a frame deeper than the current one in the stack... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7e8d1373fd4268dd3015c4e6c3ad3845aca28c6;p=thirdparty%2Ffreeradius-server.git Initialise break/return depth to a frame deeper than the current one in the stack if we're not actually breaking or returning --- diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 9713525380..3a2937ab40 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -453,7 +453,10 @@ static inline unlang_action_t unwind_to_break(unsigned int *break_depth, unlang_ unsigned int depth; depth = unlang_frame_by_op_flag(stack, UNLANG_OP_FLAG_BREAK_POINT); - if (depth == 0) return UNLANG_ACTION_CALCULATE_RESULT; + if (depth == 0) { + if (break_depth) *break_depth = stack->depth + 1; /* Don't cancel any frames! */ + return UNLANG_ACTION_CALCULATE_RESULT; + } unwind_to_depth(stack, depth + 1); /* cancel UP TO the break point */ @@ -475,7 +478,10 @@ static inline unlang_action_t unwind_to_return(unsigned int *return_depth, unlan unsigned int depth; depth = unlang_frame_by_op_flag(stack, UNLANG_OP_FLAG_RETURN_POINT); - if (depth == 0) return UNLANG_ACTION_CALCULATE_RESULT; + if (depth == 0) { + if (return_depth) *return_depth = stack->depth + 1; /* Don't cancel any frames! */ + return UNLANG_ACTION_CALCULATE_RESULT; + } unwind_to_depth(stack, depth + 1); /* cancel UP TO the break point */