]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gensec: Fix a use-after-free error in gensec_external
authorVolker Lendecke <vl@samba.org>
Mon, 6 Jul 2026 11:34:11 +0000 (13:34 +0200)
committerAnoop C S <anoopcs@samba.org>
Mon, 3 Aug 2026 09:05:30 +0000 (09:05 +0000)
.length is 0, but the pointer we hand out will be != NULL but free'ed
in the tevent_req_received()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
auth/gensec/external.c

index 300ce6b5cb3e446ea7e28a0d0bc1d26637b0d019..db8a870170b61e2e1d7ab98aebfe9bf9e6d1f687 100644 (file)
@@ -90,7 +90,11 @@ static NTSTATUS gensec_external_update_recv(struct tevent_req *req,
                return status;
        }
 
-       *out = state->out;
+       *out = (DATA_BLOB){
+               .data = talloc_move(out_mem_ctx, &state->out.data),
+               .length = state->out.length,
+       };
+
        tevent_req_received(req);
        return NT_STATUS_OK;
 }