]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Make map_fnum_to_smb2_handle type-safe
authorVolker Lendecke <vl@samba.org>
Tue, 13 May 2025 09:12:25 +0000 (11:12 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 2 Sep 2025 08:08:29 +0000 (08:08 +0000)
"struct smb2_hnd" is talloced here, use talloc_get_type_abort()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/libsmb/cli_smb2_fnum.c

index 17c02ed7dd398166ebd9fee9bc10f58bab756a9d..ce2b1552f475324f8535f6eefb6f77bbc0713f67 100644 (file)
@@ -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;
 }