mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-16 11:31:00 +08:00
e4fc4d7bc4
The implementation is from NetBSD, with the addition of mempcpy (a GNU extension) for parity with glibc and libssp. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
22 lines
435 B
C
22 lines
435 B
C
#define _GNU_SOURCE
|
|
#include <sys/cdefs.h>
|
|
#include <ssp/ssp.h>
|
|
#include <string.h>
|
|
|
|
#undef mempcpy
|
|
|
|
void *__mempcpy_chk(void * __restrict, const void * __restrict, size_t, size_t);
|
|
|
|
void *
|
|
__mempcpy_chk(void * __restrict dst, const void * __restrict src, size_t len,
|
|
size_t slen)
|
|
{
|
|
if (len > slen)
|
|
__chk_fail();
|
|
|
|
if (__ssp_overlap((const char *)src, (const char *)dst, len))
|
|
__chk_fail();
|
|
|
|
return mempcpy(dst, src, len);
|
|
}
|