From: Bastien Roucariès <ro...@debian.org>

Some implementation could add canaries after free failling the test

Signed-off-by: Bastien Roucariès <ro...@debian.org>
---
 tests/test-explicit_bzero.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c
index 526ccfd48..54eb08b26 100644
--- a/tests/test-explicit_bzero.c
+++ b/tests/test-explicit_bzero.c
@@ -112,7 +112,9 @@ test_heap (void)
   free (heapbuf);
   if (is_range_mapped (addr, addr + SECRET_SIZE))
     {
-      ASSERT (memcmp (zero, heapbuf, SECRET_SIZE) == 0);
+      /* some implementation could override freed memory by canaries so
+         compare against secret */
+      ASSERT (memcmp (SECRET, heapbuf, SECRET_SIZE) != 0);
       printf ("test_heap: address range is still mapped after free().\n");
     }
   else
-- 
2.25.1


Reply via email to