summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2026-01-17 23:21:50 +0300
committerGeert Uytterhoeven <geert@linux-m68k.org>2026-01-26 14:26:01 +0300
commitcb39cf99d88e8f2c68a41fb3bb01c4f40a8fcc30 (patch)
tree50a31ebf23bedc7309b2e5c3e34d3cd5c4198cb4
parentf16a9577b7d3643456c68621325eb594142a3506 (diff)
downloadlinux-cb39cf99d88e8f2c68a41fb3bb01c4f40a8fcc30.tar.xz
m68k: sun3: Replace vsprintf() with bounded vsnprintf()
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>
-rw-r--r--arch/m68k/sun3/prom/printf.c4
1 files 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;