Re: [PATCH] lib/string_helpers: rework overflow-dependent code
From: Justin Stitt
Date: Mon Aug 12 2024 - 14:20:54 EST
On Sat, Aug 10, 2024 at 8:42 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Sat, Aug 10, 2024 at 6:39 PM Andy Shevchenko
> <andy.shevchenko@xxxxxxxxx> wrote:
> > On Sat, Aug 10, 2024 at 2:53 AM Justin Stitt <justinstitt@xxxxxxxxxx> wrote:
> > > On Fri, Aug 09, 2024 at 02:07:57PM GMT, Andy Shevchenko wrote:
>
> ...
>
> > > But, we could do this too:
>
> > > - while (*src && --size) {
> > > - if (src[0] == '\\' && src[1] != '\0' && size > 1) {
>
> > This one is worse, I think.
> > Let's take time and not hurry up and think more about better approaches.
>
> Btw, have you played with the "do {} while (size);" approach?
Nope. Although, lots of ideas can work here. We can reorder the logic
any which way, really.
I am happy to send a patch following any idea -- so long as the
overflow-dependent code is gone :)
>
> --
> With Best Regards,
> Andy Shevchenko