]> git.ipfire.org Git - thirdparty/kmod.git/commit
shared: Add defensive measures to array handling
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 13 Aug 2024 17:44:48 +0000 (19:44 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 16 Aug 2024 05:00:09 +0000 (00:00 -0500)
commitf4b858c704cd376fe338cbdc7d5809d3270b2691
treea48daae3fbfe7e0a6bf1079336cd392cff43208b
parent6ef3643d0a622dd2fd9fcfa949f40756cf422391
shared: Add defensive measures to array handling

- Make sure that SIZE_MAX boundaries are never crossed
- Clear pointer address in struct during array_free_array
- Do nothing if array_pop is called with empty array

Also added test case for pop behavior and extended tests with
more checks.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/68
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
shared/array.c
testsuite/test-array.c