fs: fat: inode: replace sprintf() with scnprintf()

The kernel documentation notes that sprintf() is deprecated and unsafe. 
Replace it with the more preferred scnprintf() to help with hardening.

Link: https://lore.kernel.org/20260603145222.59012-1-m32285159@gmail.com
Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Maxwell Doose 2026-06-03 09:52:21 -05:00 committed by Andrew Morton
parent 1ec3cca2d8
commit aae636b546

View File

@ -1786,7 +1786,7 @@ int fat_fill_super(struct super_block *sb, struct fs_context *fc,
*/
error = -EINVAL;
sprintf(buf, "cp%d", sbi->options.codepage);
scnprintf(buf, sizeof(buf), "cp%d", sbi->options.codepage);
sbi->nls_disk = load_nls(buf);
if (!sbi->nls_disk) {
fat_msg(sb, KERN_ERR, "codepage %s not found", buf);