diff options
author | Bastien Roucariès <rouca@debian.org> | 2020-04-13 01:09:13 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-04-13 23:58:34 +0200 |
commit | 6624b766b2871c9e5ecf6400dd56cb5e5c441558 (patch) | |
tree | f5af88cbe8b698d3f0ab8ce0a1782651e91c1821 /tests | |
parent | 64e1ff019f9318c63da67d5396ac49a0df53437c (diff) | |
download | gnulib-6624b766b2871c9e5ecf6400dd56cb5e5c441558.tar.gz |
explicit_bzero tests: Fix test failure on OpenBSD 6.5.
Some implementation could add canaries after free failling the test.
* tests/test-explicit_bzero.c (test_heap): Handle implementations of
free() that overwrite the memory with canaries.
Signed-off-by: Bastien Roucariès <rouca@debian.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-explicit_bzero.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 526ccfd48d..5abc004216 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 (heapbuf, SECRET, SECRET_SIZE) != 0); printf ("test_heap: address range is still mapped after free().\n"); } else |