]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Don't mess up pathnames in cli_smb2_create_fnum_send()
authorVolker Lendecke <vl@samba.org>
Thu, 15 Dec 2022 18:06:20 +0000 (19:06 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 15 Dec 2022 21:52:34 +0000 (21:52 +0000)
Master-only bug introduced with dd9cdfb3b14: smb2_dfs_share_path() can
change the length of fname, and if it happens that the original length
hits a \ in the enlarged filename, we cut it off.

Found by accident, this really made me scratch my head when looking at
traces :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/cli_smb2_fnum.c

index 5cf6f5baf7ba25e4cc8b953c4830c876814926ca..bb99201bb61094be70d4c057be9e6a95661e39f3 100644 (file)
@@ -287,6 +287,7 @@ struct tevent_req *cli_smb2_create_fnum_send(
        if (tevent_req_nomem(fname, req)) {
                return tevent_req_post(req, ev);
        }
+       fname_len = strlen(fname);
 
        /* SMB2 is pickier about pathnames. Ensure it doesn't
           start in a '\' */