]> www.infradead.org Git - users/jedix/linux-maple.git/commit
lib/string_helpers: rework overflow-dependent code
authorJustin Stitt <justinstitt@google.com>
Thu, 8 Aug 2024 21:43:56 +0000 (14:43 -0700)
committerKees Cook <kees@kernel.org>
Thu, 15 Aug 2024 16:26:02 +0000 (09:26 -0700)
commitbbf3c7ff9dfa45be51500d23a1276991a7cd8c6e
tree0f9f1877cc36c3ecc72bad4ae289b4238c3c872f
parent0336f898881ae13b92dfd8b72e69ed1246eac762
lib/string_helpers: rework overflow-dependent code

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.

Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20240808-b4-string_helpers_caa133-v1-1-686a455167c4@google.com
Signed-off-by: Kees Cook <kees@kernel.org>
lib/string_helpers.c