public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/1] lib/vsprintf.c: fix integer overflow in vsprintf
@ 2023-03-09  2:12 Ying-Chun Liu (PaulLiu)
  2023-03-09  2:12 ` [PATCH 1/1] " Ying-Chun Liu (PaulLiu)
  0 siblings, 1 reply; 6+ messages in thread
From: Ying-Chun Liu (PaulLiu) @ 2023-03-09  2:12 UTC (permalink / raw)
  To: u-boot; +Cc: Ying-Chun Liu (PaulLiu)

vsnprintf_internal() adds 'size' to 'buf' and vsprintf() sets 'size'
to 'INT_MAX' which can overflow.  This causes sprintf() to fail when
initializing the environment on 8GB.

Instead of using 'INT_MAX', we use SIZE_MAX - buf, which is the
largest possible string that could fit without overflowing 'size'.

Tom Cherry (1):
  lib/vsprintf.c: fix integer overflow in vsprintf

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

-- 
2.39.2


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

end of thread, other threads:[~2023-08-18 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-09  2:12 [PATCH 0/1] lib/vsprintf.c: fix integer overflow in vsprintf Ying-Chun Liu (PaulLiu)
2023-03-09  2:12 ` [PATCH 1/1] " Ying-Chun Liu (PaulLiu)
2023-03-09  9:45   ` Rasmus Villemoes
2023-08-15 14:42   ` Tom Rini
2023-08-15 15:33     ` Paul Liu
2023-08-17 23:49       ` Tom Cherry

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