summaryrefslogtreecommitdiff
path: root/tests/stack_protector_test_helper.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2019-01-01 16:20:12 -0800
committerRyan Prichard <rprichard@google.com>2019-01-01 19:46:41 -0800
commit76e7fd4e26e93a2921f0fd691551f0c8dca014a7 (patch)
tree4aa3c3c63dd425c0779fa95414efe06be9c1a270 /tests/stack_protector_test_helper.cpp
parent7bd54ade8d12762ef6bdb0096f3838261f14eee5 (diff)
Fix modify_stack_protector flake
The previous test would fail to crash if the first byte of the canary was already NUL (1 of 256 runs assuming uniform canary distribution). Bug: http://b/121156651 Test: bionic unit tests
Diffstat (limited to 'tests/stack_protector_test_helper.cpp')
-rw-r--r--tests/stack_protector_test_helper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/stack_protector_test_helper.cpp b/tests/stack_protector_test_helper.cpp
index 3f15a123f..2db4ef142 100644
--- a/tests/stack_protector_test_helper.cpp
+++ b/tests/stack_protector_test_helper.cpp
@@ -21,6 +21,6 @@ __attribute__((noinline)) void modify_stack_protector_test() {
// the line of defense *after* that.
// Without volatile, the generic x86/x86-64 targets don't write to the stack.
volatile char* p = buf;
- int size = static_cast<int>(sizeof(buf) + 1);
+ int size = static_cast<int>(sizeof(buf) + sizeof(void*));
while ((p - buf) < size) *p++ = '\0';
}