]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
exfat: check if filename entries exceeds max filename length
authorNamjae Jeon <linkinjeon@kernel.org>
Thu, 13 Jul 2023 12:59:37 +0000 (21:59 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Aug 2023 12:23:37 +0000 (14:23 +0200)
commit6b64974e02ea82d0bae917f1fa79495a1a59b5bf
treed26b7b27cf34d722c76c3dd433664d83ccd13321
parent6065b3017107eb7f7bac44dda46b7ff09165c701
exfat: check if filename entries exceeds max filename length

commit d42334578eba1390859012ebb91e1e556d51db49 upstream.

exfat_extract_uni_name copies characters from a given file name entry into
the 'uniname' variable. This variable is actually defined on the stack of
the exfat_readdir() function. According to the definition of
the 'exfat_uni_name' type, the file name should be limited 255 characters
(+ null teminator space), but the exfat_get_uniname_from_ext_entry()
function can write more characters because there is no check if filename
entries exceeds max filename length. This patch add the check not to copy
filename characters when exceeding max filename length.

Cc: stable@vger.kernel.org
Cc: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reported-by: Maxim Suhanov <dfirblog@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[Harshit: backport to 5.15.y]
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/exfat/dir.c