Correct - no compiler or static analysis tool flags this. The overflow is
mathematically impossible for these argument types, so the patch doesn't fix an
actual bug.
I addressed Dan's specific wording feedback but missed responding to your core
objection about the patch being unnecessary. Given the above, I'll drop this
patch unless you see value in keeping it as a documented safety margin.
Regards,
Tomasz Unger
W poniedziaĆek, 24 sierpnia 2026 10:59:40 CEST, Andy Shevchenko
<[email protected]> napisaĆ(-a):
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