]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Use talloc_strndup() to cut a backslash
authorVolker Lendecke <vl@samba.org>
Tue, 21 Apr 2020 06:05:57 +0000 (08:05 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 May 2020 11:48:39 +0000 (11:48 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/libsmb/cli_smb2_fnum.c

index 40146af30f9ccbaac554371f5e479dbb6ca8c579..d29341c1708795d01892add9b2d5f84755d8154a 100644 (file)
@@ -1549,11 +1549,10 @@ NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
        /* SMB2 is pickier about pathnames. Ensure it doesn't
           end in a '\' */
        if (namelen > 0 && name[namelen-1] == '\\') {
-               char *modname = talloc_strdup(talloc_tos(), name);
+               char *modname = talloc_strndup(talloc_tos(), name, namelen-1);
                if (modname == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }
-               modname[namelen-1] = '\0';
                name = modname;
        }