diff --git a/tests/ssp/main.c b/tests/ssp/main.c index ec5c1bc1fdef50f5ce4424f3146e52a2bfd9c7ab..c7e7ca679c57f35536f4eecb5ccfe5e15b4201b9 100644 --- a/tests/ssp/main.c +++ b/tests/ssp/main.c @@ -28,9 +28,13 @@ void test_func(void) { char buf[16]; + /* clang will detect the buffer overflow + * and throw an error if we use `buf` directly */ + void *buffer_to_confuse_compiler = buf; + /* cppcheck-suppress bufferAccessOutOfBounds * (reason: deliberately overflowing stack) */ - memset(buf, 0, 32); + memset(buffer_to_confuse_compiler, 0, 32); } int main(void)