Re: [PATCH] lib: string_helpers: fix potential snprintf() output truncation
From: Andy Shevchenko
Date: Tue Oct 22 2024 - 05:19:40 EST
On Tue, Oct 22, 2024 at 10:30 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
>
> On Tue, Oct 22, 2024 at 9:15 AM Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
> >
> > On 21. 10. 24, 12:04, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> > >
> > > The output of ".%03u" with the unsigned int in range [0, 4294966295] may
> > > get truncated if the target buffer is not 12 bytes.
> >
> > Perhaps, if you elaborate on how 'remainder' can become > 999?
>
> Yeah, I guess it can't. Not sure what we do about such false
> positives, do we have some common way to suppress them?
I already pointed out these kinds of warnings from GCC.
https://lore.kernel.org/all/Zt73a3t8Y8uH5MHG@xxxxxxxxxxxxxxxxxx/
--
With Best Regards,
Andy Shevchenko