On Mon, Aug 12, 2024 at 11:44 AM Kees Cook <[email protected]> wrote: > > On Thu, 08 Aug 2024 14:43:56 -0700, Justin Stitt wrote: > > When @size is 0, the desired behavior is to allow unlimited bytes to be > > parsed. Currently, this relies on some intentional arithmetic overflow > > where --size gives us SIZE_MAX when size is 0. > > > > Explicitly spell out the desired behavior without relying on intentional > > overflow/underflow. > > > > [...] > > Since we can't have allocations larger than INT_MAX, SIZE_MAX is > sufficiently large for this use-case, and the "off by one" introduce > here isn't meaningful. I prefer the improved readability and lack of > wrapping pre-decrement.
Great! Thanks. > > Applied to for-next/hardening, thanks! > > [1/1] lib/string_helpers: rework overflow-dependent code > https://git.kernel.org/kees/c/5d6b91b74ccd > > Take care, > > -- > Kees Cook >
