aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/string/memset_explicit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/memset_explicit.c')
-rw-r--r--lib/libc/string/memset_explicit.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/libc/string/memset_explicit.c b/lib/libc/string/memset_explicit.c
new file mode 100644
index 000000000000..b2b9a79c40c8
--- /dev/null
+++ b/lib/libc/string/memset_explicit.c
@@ -0,0 +1,27 @@
+/*-
+ * SPDF-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org>
+ */
+
+#include <string.h>
+#include <ssp/ssp.h>
+
+__attribute__((weak)) void __memset_explicit_hook(void *, int, size_t);
+
+__attribute__((weak)) void
+__memset_explicit_hook(void *buf, int ch, size_t len)
+{
+ (void)buf;
+ (void)ch;
+ (void)len;
+}
+
+void *
+__ssp_real(memset_explicit)(void *buf, int ch, size_t len)
+{
+ memset(buf, ch, len);
+ __memset_explicit_hook(buf, ch, len);
+
+ return (buf);
+}