From: Volker Lendecke Date: Tue, 13 May 2025 09:12:25 +0000 (+0200) Subject: libsmb: Make map_fnum_to_smb2_handle type-safe X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=911b683819c17d4cc1ee3d17be2c8adefb8127fb;p=thirdparty%2Fsamba.git 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 --- 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; }