aboutsummaryrefslogtreecommitdiff
path: root/string/test-strnlen.c
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2021-06-23 19:17:29 -0400
committerNoah Goldstein <goldstein.w.n@gmail.com>2021-06-24 19:14:15 -0400
commitbd3a2b3ed18fdeff0b370110c35850b51d025e8c (patch)
treeb51b2e0cae9838cbf186f4f14072257c9788d070 /string/test-strnlen.c
parent9f70985569888d68612012fcb538c47c154c1e8b (diff)
downloadglibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.zip
glibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.tar.gz
glibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.tar.bz2
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 <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'string/test-strnlen.c')
-rw-r--r--string/test-strnlen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index f53e092..bb5d9b5 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);
}
}
}