]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
m68k: sun3: Replace vsprintf() with bounded vsnprintf()
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 17 Jan 2026 20:21:50 +0000 (21:21 +0100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 26 Jan 2026 11:26:01 +0000 (12:26 +0100)
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>
Link: https://patch.msgid.link/20260117202152.1036278-2-thorsten.blum@linux.dev
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/sun3/prom/printf.c

index db5537ef12504a8b5936ee6b712cb16e84ec5571..cb4934d398330020c8ead6ffbfa3aa835be64b25 100644 (file)
@@ -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;