public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf()
@ 2026-01-17 20:21 Thorsten Blum
  2026-01-26 11:15 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-01-17 20:21 UTC (permalink / raw)
  To: Sam Creasey, Geert Uytterhoeven; +Cc: Thorsten Blum, linux-m68k, linux-kernel

vsprintf() performs no bounds checking and can overflow - replace it
with the safer vsnprintf().

Also remove the useless '+ 1' that is a leftover of commit 66ed28ea096c
("m68k: sun3: Remove unused vsprintf() return value in prom_printf()").

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Compile-tested only.
---
 arch/m68k/sun3/prom/printf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c
index db5537ef1250..cb4934d39833 100644
--- a/arch/m68k/sun3/prom/printf.c
+++ b/arch/m68k/sun3/prom/printf.c
@@ -30,9 +30,9 @@ prom_printf(char *fmt, ...)
 
 #ifdef CONFIG_KGDB
 	ppbuf[0] = 'O';
-	vsprintf(ppbuf + 1, fmt, args) + 1;
+	vsnprintf(ppbuf + 1, sizeof(ppbuf) - 1, fmt, args);
 #else
-	vsprintf(ppbuf, fmt, args);
+	vsnprintf(ppbuf, sizeof(ppbuf), fmt, args);
 #endif
 
 	bptr = ppbuf;
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf()
  2026-01-17 20:21 [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf() Thorsten Blum
@ 2026-01-26 11:15 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-01-26 11:15 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Sam Creasey, linux-m68k, linux-kernel

On Sat, 17 Jan 2026 at 21:22, Thorsten Blum <thorsten.blum@linux.dev> wrote:
> vsprintf() performs no bounds checking and can overflow - replace it
> with the safer vsnprintf().
>
> Also remove the useless '+ 1' that is a leftover of commit 66ed28ea096c
> ("m68k: sun3: Remove unused vsprintf() return value in prom_printf()").
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.20.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-26 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-17 20:21 [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf() Thorsten Blum
2026-01-26 11:15 ` Geert Uytterhoeven

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