From 911b683819c17d4cc1ee3d17be2c8adefb8127fb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 13 May 2025 11:12:25 +0200 Subject: [PATCH] libsmb: Make map_fnum_to_smb2_handle type-safe "struct smb2_hnd" is talloced here, use talloc_get_type_abort() Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- source3/libsmb/cli_smb2_fnum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 17c02ed7dd3..ce2b1552f47 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -111,14 +111,16 @@ static NTSTATUS map_fnum_to_smb2_handle(struct cli_state *cli, struct smb2_hnd **pph) /* Out */ { struct idr_context *idp = cli->smb2.open_handles; + void *ph = NULL; if (idp == NULL) { return NT_STATUS_INVALID_PARAMETER; } - *pph = (struct smb2_hnd *)idr_find(idp, fnum); - if (*pph == NULL) { + ph = idr_find(idp, fnum); + if (ph == NULL) { return NT_STATUS_INVALID_HANDLE; } + *pph = talloc_get_type_abort(ph, struct smb2_hnd); return NT_STATUS_OK; } -- 2.47.3