Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / ssp / mempcpy_chk.c
blobfc2ccf894837dc457b27950b88ccb92c8a29614f
1 #define _GNU_SOURCE
2 #include <sys/cdefs.h>
3 #include <ssp/ssp.h>
4 #include <string.h>
6 #undef mempcpy
8 void *__mempcpy_chk(void * __restrict, const void * __restrict, size_t, size_t);
10 void *
11 __mempcpy_chk(void * __restrict dst, const void * __restrict src, size_t len,
12 size_t slen)
14 if (len > slen)
15 __chk_fail();
17 if (__ssp_overlap((const char *)src, (const char *)dst, len))
18 __chk_fail();
20 return mempcpy(dst, src, len);