summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/suites/test_chunk.c
diff options
context:
space:
mode:
authorRomain Francoise <rfrancoise@debian.org>2014-04-15 19:34:32 +0200
committerRomain Francoise <rfrancoise@debian.org>2014-04-15 19:34:32 +0200
commitc5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9 (patch)
treed4e2118cbd411caa1a0528eac831030109bc6e65 /src/libstrongswan/tests/suites/test_chunk.c
parent15fb7904f4431a6e7c305fd08732458f7f885e7e (diff)
downloadvyos-strongswan-c5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9.tar.gz
vyos-strongswan-c5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9.zip
Import upstream version 5.1.3
Diffstat (limited to 'src/libstrongswan/tests/suites/test_chunk.c')
-rw-r--r--src/libstrongswan/tests/suites/test_chunk.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstrongswan/tests/suites/test_chunk.c b/src/libstrongswan/tests/suites/test_chunk.c
index e373fbdb6..34ace2894 100644
--- a/src/libstrongswan/tests/suites/test_chunk.c
+++ b/src/libstrongswan/tests/suites/test_chunk.c
@@ -117,10 +117,13 @@ START_TEST(test_chunk_clear)
}
chunk_clear(&chunk);
/* check memory area of freed chunk. We can't use ck_assert() for this
- * test directly, as it might allocate data at the freed area. */
- for (i = 0; i < 64; i++)
+ * test directly, as it might allocate data at the freed area. comparing
+ * two bytes at once reduces the chances of conflicts if memory got
+ * overwritten already */
+ for (i = 0; i < 64; i += 2)
{
- if (ptr[i] != 0 && ptr[i] == i)
+ if (ptr[i] != 0 && ptr[i] == i &&
+ ptr[i+1] != 0 && ptr[i+1] == i+1)
{
cleared = FALSE;
break;