Thread (2 messages) 2 messages, 2 authors, 2026-08-24

Re: [PATCH v2] staging: fbtft: prefer snprintf over sprintf in fbtft-core.c

flat view

From: Andy Shevchenko <hidden>
Date: 2026-08-24 08:59:40
Also in: dri-devel, linux-staging, lkml

On Thu, Aug 20, 2026 at 06:58:12PM +0200, Tomasz Unger wrote:
Using sprintf has potential for buffer overflows if the formatted
sprintf()
string exceeds the destination buffer size. Replace it with
snprintf, passing sizeof() of the fixed-size stack buffers
snprintf()
(text1[50] and text2[50]) so the write is always bounded.

An overflow is impossible here: even the worst case for the
argument types (size_t for text1, three ints for text2) still
fits within 50 bytes. Use snprintf() rather than scnprintf()
since the return value is not used here.
Then why the patch is needed at all? Do you have any compiler that warns
you about something?

...

It looks like you ignored all my comments against v1...

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help