]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb: server: Fix extension string in ksmbd_extract_shortname()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 6 Aug 2025 01:03:49 +0000 (03:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:09:06 +0000 (12:09 +0200)
commit2f4d88f5e5eeb94d013ffbe9da6746cf2d419d4f
tree33e3637948d701904fbf299b71fa9ad8f5d480ee
parentfa1c47af4ff641cf9197ecdb1f8240cbb30389c1
smb: server: Fix extension string in ksmbd_extract_shortname()

commit 8e7d178d06e8937454b6d2f2811fa6a15656a214 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: e2f34481b24d ("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>
fs/smb/server/smb_common.c