summaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest/string_test.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-07-17 11:51:52 +0200
committerDave Barach <openvpp@barachs.net>2020-07-19 11:31:36 +0000
commit2e64b5a934a6e014c161e6f73aa461db1e4c7449 (patch)
treebc2db3d6b51fb98c5a2ea1cd2dd34adb34d5c389 /src/plugins/unittest/string_test.c
parentdf494dafa08ef468216802647947a6dc94664dfe (diff)
unittest: keep ASAN happy for non-terminated string tests
Type: fix Change-Id: Iae9e84d4297acd54c909d3a8a39adafcd86b0a91 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/unittest/string_test.c')
-rw-r--r--src/plugins/unittest/string_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/unittest/string_test.c b/src/plugins/unittest/string_test.c
index fb33edb2f43..d99d7331a3c 100644
--- a/src/plugins/unittest/string_test.c
+++ b/src/plugins/unittest/string_test.c
@@ -508,6 +508,7 @@ test_clib_strncmp (vlib_main_t * vm, unformat_input_t * input)
/* unterminated s1 */
s1[s1len] = 0x1;
+ CLIB_MEM_UNPOISON (s1, CLIB_STRING_MACRO_MAX);
indicator = clib_strncmp (s1, "Every moment is a fresh beginning",
sizeof ("every moment is a fresh beginning") - 1);
if (indicator != 0)
@@ -1592,6 +1593,7 @@ test_clib_strstr (vlib_main_t * vm, unformat_input_t * input)
/* unterminated s1 and s2 */
memset_s (s1, ARRAY_LEN (s1), 0xfe, ARRAY_LEN (s1));
+ CLIB_MEM_UNPOISON (s1, CLIB_STRING_MACRO_MAX);
sub = clib_strstr (s1, s1);
if (sub == 0)
return -1;