public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] lib/vsprintf: assorted bug fixes
@ 2026-03-24 22:49 Josh Law
  2026-03-24 22:49 ` [PATCH 1/4] lib/vsprintf: always advance args in bstr_printf() pointer path Josh Law
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Josh Law @ 2026-03-24 22:49 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt
  Cc: Andy Shevchenko, Rasmus Villemoes, Sergey Senozhatsky,
	Andrew Morton, Josh Law, linux-kernel

Four small fixes found during an audit of lib/vsprintf.c:

1. bstr_printf() fails to advance the args pointer past a
   pre-rendered pointer string when the output buffer is full,
   corrupting all subsequent output.

2. vbin_printf() writes end[-1] unconditionally when NUL-terminating
   a pointer string, which is an OOB write when size is zero.

3. vsscanf() uses s16 for field_width but assigns from skip_atoi()
   which returns int, silently truncating large widths to negative
   and aborting parsing.

4. format_decode() is missing a (u8) cast on the second lookup into
   the format_state table, allowing a negative array index on
   signed-char platforms.

Josh Law (4):
  lib/vsprintf: always advance args in bstr_printf() pointer path
  lib/vsprintf: fix OOB write in vbin_printf() when size is zero
  lib/vsprintf: use int for field_width in vsscanf()
  lib/vsprintf: add missing (u8) cast in format_decode() lookup

 lib/vsprintf.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2026-04-01 18:29 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 22:49 [PATCH 0/4] lib/vsprintf: assorted bug fixes Josh Law
2026-03-24 22:49 ` [PATCH 1/4] lib/vsprintf: always advance args in bstr_printf() pointer path Josh Law
2026-03-30 16:06   ` Petr Mladek
2026-03-24 22:49 ` [PATCH 2/4] lib/vsprintf: fix OOB write in vbin_printf() when size is zero Josh Law
2026-03-30 16:17   ` Petr Mladek
2026-03-30 16:31   ` Steven Rostedt
2026-03-30 16:32     ` Josh Law
2026-03-30 16:32     ` Josh Law
2026-03-30 16:32     ` Josh Law
2026-03-30 16:34     ` Josh Law
2026-03-24 22:49 ` [PATCH 3/4] lib/vsprintf: use int for field_width in vsscanf() Josh Law
2026-03-25 12:00   ` Andy Shevchenko
2026-03-31 14:31     ` Petr Mladek
2026-03-31 15:35       ` David Laight
2026-03-31 16:12         ` Petr Mladek
2026-03-31 16:13           ` Josh Law
2026-03-31 16:13           ` Josh Law
2026-03-31 16:13           ` Josh Law
2026-04-01 14:22           ` David Laight
2026-04-01 18:29             ` David Laight
2026-03-24 22:49 ` [PATCH 4/4] lib/vsprintf: add missing (u8) cast in format_decode() lookup Josh Law
2026-03-25 12:02   ` Andy Shevchenko
2026-03-31 14:33   ` Petr Mladek
2026-03-31 14:44     ` Josh Law
2026-03-31 14:44     ` Josh Law
2026-03-25 12:05 ` [PATCH 0/4] lib/vsprintf: assorted bug fixes Andy Shevchenko
2026-03-25 17:20   ` Josh Law

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