From bd3a2b3ed18fdeff0b370110c35850b51d025e8c Mon Sep 17 00:00:00 2001 From: Noah Goldstein Date: Wed, 23 Jun 2021 19:17:29 -0400 Subject: String: Add three more overflow tests cases to test-strnlen.c No bug. Just seem like relevant cases given that strnlen will use s + maxlen in many implementations. Signed-off-by: Noah Goldstein Reviewed-by: H.J. Lu --- string/test-strnlen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/string/test-strnlen.c b/string/test-strnlen.c index f53e09263f..bb5d9b5f04 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -117,6 +117,10 @@ do_overflow_tests (void) do_test (0, i, ~len + i, BIG_CHAR); do_test (0, i, ~len - buf_addr - i, BIG_CHAR); do_test (0, i, ~len - buf_addr + i, BIG_CHAR); + + do_test (0, i, -buf_addr, BIG_CHAR); + do_test (0, i, j - buf_addr, BIG_CHAR); + do_test (0, i, -buf_addr - j, BIG_CHAR); } } } -- cgit 1.4.1