From 28bc1ab923addc5b0af4731ad1155701b0e08a4a Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 19 Sep 2023 17:34:57 +0100 Subject: [PATCH] Use exact bounds for allocations in mbedtls_ct_memcmp_partial test Signed-off-by: Dave Rodgman --- tests/suites/test_suite_constant_time.function | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/suites/test_suite_constant_time.function b/tests/suites/test_suite_constant_time.function index baf77f3ca..9df9432eb 100644 --- a/tests/suites/test_suite_constant_time.function +++ b/tests/suites/test_suite_constant_time.function @@ -263,8 +263,9 @@ exit: void mbedtls_ct_memcmp_partial(int diff, int size, int skip_head, int skip_tail) { uint8_t *a = NULL, *b = NULL; - TEST_CALLOC(a, size + 1); // + 1 to avoid NULL result from TEST_CALLOC(0) - TEST_CALLOC(b, size + 1); + + TEST_CALLOC_NONNULL(a, size); + TEST_CALLOC_NONNULL(b, size); TEST_ASSERT((skip_head + skip_tail) <= size);