From: Nick Porter Date: Thu, 19 Jun 2025 08:03:36 +0000 (+0100) Subject: Ensure detached requests don't try to access results in the parent X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f3ecb0651e8a8b13d9820f5fa4b5db13d16588d;p=thirdparty%2Ffreeradius-server.git Ensure detached requests don't try to access results in the parent --- diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 409bfbb8ed0..5333591fddd 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1287,11 +1287,24 @@ void unlang_interpret_request_detach(request_t *request) { unlang_stack_t *stack = request->stack; unlang_interpret_t *intp; + unlang_stack_frame_t *frame; + int i; if (!fr_cond_assert(stack != NULL)) return; if (!request_is_detachable(request)) return; + /* + * Detached requests can't send results back to the parent + * so ensure that all frames not using the section result are + * using the scratch result. + */ + for (i = stack->depth; i >= 0; i--) { + frame = &stack->frame[i]; + if (frame->result_p == &frame->section_result) continue; + frame->result_p = &frame->scratch_result; + } + intp = stack->intp; intp->funcs.detach(request, intp->uctx);