public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH] m68k: emu: Replace unbounded sprintf in nfhd_init_one
@ 2026-02-22 17:08 Thorsten Blum
  0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-02-22 17:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Kees Cook, Martin K. Petersen, Jens Axboe,
	Al Viro
  Cc: Thorsten Blum, linux-m68k, linux-kernel

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/m68k/emu/nfblock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 94a4fadc651a..96fed5cd7677 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -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)
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-22 17:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-22 17:08 [PATCH] m68k: emu: Replace unbounded sprintf in nfhd_init_one Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox