m68k: emu: Replace unbounded sprintf() in nfhd_init_one()

Replace unbounded sprintf() with the safer snprintf().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patch.msgid.link/20260318001632.2974-3-thorsten.blum@linux.dev
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Thorsten Blum
2026-03-18 01:16:33 +01:00
committed by Geert Uytterhoeven
parent 5247c783dc
commit 59747bec5d

View File

@@ -132,7 +132,8 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->disk->minors = 16;
dev->disk->fops = &nfhd_ops;
dev->disk->private_data = dev;
sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
snprintf(dev->disk->disk_name, sizeof(dev->disk->disk_name), "nfhd%u",
dev_id);
set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
err = add_disk(dev->disk);
if (err)