source: trunk/libs/newlib/src/newlib/libc/ssp/mempcpy_chk.c @ 450

Last change on this file since 450 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 435 bytes
Line 
1#define _GNU_SOURCE
2#include <sys/cdefs.h>
3#include <ssp/ssp.h>
4#include <string.h>
5
6#undef mempcpy
7
8void *__mempcpy_chk(void * __restrict, const void * __restrict, size_t, size_t);
9
10void *
11__mempcpy_chk(void * __restrict dst, const void * __restrict src, size_t len,
12    size_t slen)
13{
14        if (len > slen)
15                __chk_fail();
16
17        if (__ssp_overlap((const char *)src, (const char *)dst, len))
18                __chk_fail();
19
20        return mempcpy(dst, src, len);
21}
Note: See TracBrowser for help on using the repository browser.