xref: /freebsd/lib/libc/string/memset_explicit.c (revision db33c6f3ae9d1231087710068ee4ea5398aacca7)
1 /*-
2  * SPDF-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org>
5  */
6 
7 #include <string.h>
8 #include <ssp/ssp.h>
9 
10 __attribute__((weak)) void __memset_explicit_hook(void *, int, size_t);
11 
12 __attribute__((weak)) void
13 __memset_explicit_hook(void *buf, int ch, size_t len)
14 {
15 	(void)buf;
16 	(void)ch;
17 	(void)len;
18 }
19 
20 void *
21 __ssp_real(memset_explicit)(void *buf, int ch, size_t len)
22 {
23 	memset(buf, ch, len);
24 	__memset_explicit_hook(buf, ch, len);
25 
26 	return (buf);
27 }
28