diff options
author | Kees Cook <keescook@chromium.org> | 2021-06-16 14:42:23 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-02-13 16:50:06 -0800 |
commit | 28e77cc1c0686621a4d416f599cee5ab369daa0a (patch) | |
tree | c58b0cfacdeab1d3f46cbd12f91ebcfb37a7ab56 /lib/test_fortify | |
parent | 938a000e3f9bead24ea753286b3e4d2423275c9e (diff) | |
download | linux-rpi-28e77cc1c0686621a4d416f599cee5ab369daa0a.tar.gz linux-rpi-28e77cc1c0686621a4d416f599cee5ab369daa0a.tar.bz2 linux-rpi-28e77cc1c0686621a4d416f599cee5ab369daa0a.zip |
fortify: Detect struct member overflows in memset() at compile-time
As done for memcpy(), also update memset() to use the same tightened
compile-time bounds checking under CONFIG_FORTIFY_SOURCE.
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'lib/test_fortify')
-rw-r--r-- | lib/test_fortify/write_overflow_field-memset.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/test_fortify/write_overflow_field-memset.c b/lib/test_fortify/write_overflow_field-memset.c new file mode 100644 index 000000000000..2331da26909e --- /dev/null +++ b/lib/test_fortify/write_overflow_field-memset.c @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-only +#define TEST \ + memset(instance.buf, 0x42, sizeof(instance.buf) + 1) + +#include "test_fortify.h" |