From: Thorsten Blum <thorsten.blum@linux.dev>
To: Sam Creasey <sammy@sammy.net>, Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org
Subject: [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf()
Date: Sat, 17 Jan 2026 21:21:50 +0100 [thread overview]
Message-ID: <20260117202152.1036278-2-thorsten.blum@linux.dev> (raw)
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
next reply other threads:[~2026-01-17 20:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-17 20:21 Thorsten Blum [this message]
2026-01-26 11:15 ` [PATCH] m68k: sun3: Replace vsprintf() with bounded vsnprintf() Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260117202152.1036278-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=sammy@sammy.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox