Skip to content

Commit de17000

Browse files
tobluxgregkh
authored andcommitted
smb: server: Fix extension string in ksmbd_extract_shortname()
commit 8e7d178 upstream. In ksmbd_extract_shortname(), strscpy() is incorrectly called with the length of the source string (excluding the NUL terminator) rather than the size of the destination buffer. This results in "__" being copied to 'extension' rather than "___" (two underscores instead of three). Use the destination buffer size instead to ensure that the string "___" (three underscores) is copied correctly. Cc: stable@vger.kernel.org Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cb092fc commit de17000

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/smb/server/smb_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
508508

509509
p = strrchr(longname, '.');
510510
if (p == longname) { /*name starts with a dot*/
511-
strscpy(extension, "___", strlen("___"));
511+
strscpy(extension, "___", sizeof(extension));
512512
} else {
513513
if (p) {
514514
p++;

0 commit comments

Comments
 (0)