Merge pull request #7777 from x3ro/fix-ssp-test-on-macos
tests/ssp: Fix on macOS while compiling w/ clang
This commit is contained in:
commit
4de06b5f96
@ -28,9 +28,13 @@ void test_func(void)
|
|||||||
{
|
{
|
||||||
char buf[16];
|
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
|
/* cppcheck-suppress bufferAccessOutOfBounds
|
||||||
* (reason: deliberately overflowing stack) */
|
* (reason: deliberately overflowing stack) */
|
||||||
memset(buf, 0, 32);
|
memset(buffer_to_confuse_compiler, 0, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user