From 516c9779fbae5c5b2393d538d9265cd294b36379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 16 Sep 2022 11:36:07 +0300 Subject: [PATCH] test: stacksmash: Make sure to change the value of the written byte If the low byte of the stack cookie happens to be zero, we previously wouldn't trigger any error. This avoids accidentally failing to trigger the stack protector once per 256 runs, roughly. --- test/stacksmash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stacksmash.c b/test/stacksmash.c index 019b1c3..c7c7304 100644 --- a/test/stacksmash.c +++ b/test/stacksmash.c @@ -20,7 +20,7 @@ __attribute__((noinline)) void func(char *ptr, int idx) { - ptr[idx] = 0; + ptr[idx] ^= 1; } int main(int argc, char *argv[]) {