summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-06-16 14:42:23 -0700
committerKees Cook <keescook@chromium.org>2022-02-13 16:50:06 -0800
commit28e77cc1c0686621a4d416f599cee5ab369daa0a (patch)
treec58b0cfacdeab1d3f46cbd12f91ebcfb37a7ab56 /lib
parent938a000e3f9bead24ea753286b3e4d2423275c9e (diff)
downloadlinux-stable-28e77cc1c0686621a4d416f599cee5ab369daa0a.tar.gz
linux-stable-28e77cc1c0686621a4d416f599cee5ab369daa0a.tar.bz2
linux-stable-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')
-rw-r--r--lib/test_fortify/write_overflow_field-memset.c5
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"