fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit 5aabc7e6aad28327d75671e52c50060e4543112c
parent ad9a6d93b7ad46cf7998f3df753e94a684ac9b37
Author: sin <sin@2f30.org>
Date:   Mon, 25 Feb 2019 13:01:12 +0000

Make use of builtins whenever possible

Diffstat:
Minclude/string.h | 4++--
Minclude/wchar.h | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/string.h b/include/string.h @@ -50,7 +50,7 @@ _FORTIFY_FN(memcpy) void *memcpy(void *__od, const void *__os, size_t __n) __builtin_trap(); if (__n > __bd || __n > __bs) __builtin_trap(); - return __orig_memcpy(__od, __os, __n); + return __builtin_memcpy(__od, __os, __n); } _FORTIFY_FN(memmove) void *memmove(void *__d, const void *__s, size_t __n) @@ -69,7 +69,7 @@ _FORTIFY_FN(memset) void *memset(void *__d, int __c, size_t __n) if (__n > __b) __builtin_trap(); - return __orig_memset(__d, __c, __n); + return __builtin_memset(__d, __c, __n); } #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ diff --git a/include/wchar.h b/include/wchar.h @@ -121,7 +121,7 @@ _FORTIFY_FN(wcrtomb) size_t wcrtomb(char *__s, wchar_t __w, mbstate_t *__st) return __r; if (__r > __b) __builtin_trap(); - memcpy(__s, __buf, __r); + __builtin_memcpy(__s, __buf, __r); return __r; } return __orig_wcrtomb(__s, __w, __st);