freebsd-src/lib/libc/string/memset_explicit.c
Robert Clausecker 8983acc8de lib/libc/string: apply SSP hardening and tests to memset_explicit
Reviewed by:	emaste, kevans
Differential Revision:	https://reviews.freebsd.org/D47286
2024-11-14 23:10:00 +01:00

27 lines
495 B
C

/*-
* 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);
}