Skip to content

Commit 8e7d178

Browse files
tobluxsmfrench
authored andcommitted
smb: server: Fix extension string in ksmbd_extract_shortname()
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>
1 parent e6bb919 commit 8e7d178

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
@@ -515,7 +515,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
515515

516516
p = strrchr(longname, '.');
517517
if (p == longname) { /*name starts with a dot*/
518-
strscpy(extension, "___", strlen("___"));
518+
strscpy(extension, "___", sizeof(extension));
519519
} else {
520520
if (p) {
521521
p++;

0 commit comments

Comments
 (0)