Re: [PATCH] lib/string_helpers: rework overflow-dependent code

From: Andy Shevchenko
Date: Sat Aug 10 2024 - 11:42:44 EST


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?

--
With Best Regards,
Andy Shevchenko