]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Ensure detached requests don't try to access results in the parent
authorNick Porter <nick@portercomputing.co.uk>
Thu, 19 Jun 2025 08:03:36 +0000 (09:03 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 19 Jun 2025 08:24:11 +0000 (09:24 +0100)
src/lib/unlang/interpret.c

index 409bfbb8ed0632c557dae94e0bc74c496ef5a72d..5333591fddd9cd7ed36fcbfb7f955ecc2de3993a 100644 (file)
@@ -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);