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: [email protected] Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3") Signed-off-by: Thorsten Blum <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent e6bb919 commit 8e7d178

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)