fortify-headers

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

commit a018052d410126f94c2602b208b099839d333b05
parent 95441d2647a149ffa6db4a81c0a19e96e3b56ba5
Author: q66 <q66@chimera-linux.org>
Date:   Fri, 15 Dec 2023 23:48:58 +0100

Rename some macros to be more namespace-friendly

Diffstat:
Minclude/fortify-headers.h | 24++++++++++++------------
Minclude/poll.h | 4++--
Minclude/stdio.h | 86++++++++++++++++++++++++++++++++++++++++----------------------------------------
Minclude/stdlib.h | 26+++++++++++++-------------
Minclude/string.h | 126++++++++++++++++++++++++++++++++++++++++----------------------------------------
Minclude/strings.h | 12++++++------
Minclude/sys/select.h | 6+++---
Minclude/sys/socket.h | 16++++++++--------
Minclude/unistd.h | 46+++++++++++++++++++++++-----------------------
Minclude/wchar.h | 28++++++++++++++--------------
10 files changed, 187 insertions(+), 187 deletions(-)

diff --git a/include/fortify-headers.h b/include/fortify-headers.h @@ -71,38 +71,38 @@ * See: * - https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html */ -#define __bos(ptr, type) __builtin_dynamic_object_size (ptr, type) +#define __fh_bos(ptr, type) __builtin_dynamic_object_size (ptr, type) #else -#define __bos(ptr, type) __builtin_object_size (ptr, type) +#define __fh_bos(ptr, type) __builtin_object_size (ptr, type) #endif #if defined __has_attribute #if __has_attribute (access) -#define __access(...) __attribute__ ((access (__VA_ARGS__))) +#define __fh_access(...) __attribute__ ((access (__VA_ARGS__))) #else -#define __access(...) +#define __fh_access(...) #endif #if __has_attribute (format) -#define __format(...) __attribute__ ((format (__VA_ARGS__))) +#define __fh_format(...) __attribute__ ((format (__VA_ARGS__))) #else -#define __format(...) +#define __fh_format(...) #endif #if __has_attribute (malloc) #ifdef __clang__ -#define __malloc(...) __attribute__ ((malloc)) +#define __fh_malloc(...) __attribute__ ((malloc)) #else -#define __malloc(...) __attribute__ ((malloc, __VA_ARGS__)) +#define __fh_malloc(...) __attribute__ ((malloc, __VA_ARGS__)) #endif /* __clang__ */ #else -#define __malloc(...) +#define __fh_malloc(...) #endif -#if __has_attribute (alloc_size) && !defined(__alloc_size) -#define __alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) +#if __has_attribute (alloc_size) && !defined(__fh_alloc_size) +#define __fh_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__))) #else -#define __alloc_size(...) +#define __fh_alloc_size(...) #endif #if __has_attribute (diagnose_as_builtin) diff --git a/include/poll.h b/include/poll.h @@ -36,7 +36,7 @@ __diagnose_as_builtin(__builtin_poll, 1, 2, 3) #endif _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __s) { - __fh_size_t __b = __bos(__f, 0); + __fh_size_t __b = __fh_bos(__f, 0); if (__n > __b / sizeof(struct pollfd)) __builtin_trap(); @@ -51,7 +51,7 @@ __diagnose_as_builtin(__builtin_ppoll, 1, 2, 3, 4) _FORTIFY_FN(ppoll) int ppoll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, const struct timespec *__s, const sigset_t *__m) { - __fh_size_t __b = __bos(__f, 0); + __fh_size_t __b = __fh_bos(__f, 0); if (__n > __b / sizeof(struct pollfd)) __builtin_trap(); diff --git a/include/stdio.h b/include/stdio.h @@ -44,7 +44,7 @@ extern "C" { #undef fmemopen #undef popen -__access(read_only, 2) +__fh_access(read_only, 2) #if __has_builtin(__builtin_fdopen) __diagnose_as_builtin(__builtin_fdopen, 1, 2) #endif @@ -53,7 +53,7 @@ _FORTIFY_FN(fdopen) FILE *fdopen(int __f, const char* _FORTIFY_POS0 __m) return __orig_fdopen(__f, __m); } -__malloc(malloc (fclose, 1)) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_fmemopen) __diagnose_as_builtin(__builtin_fmemopen, 1, 2, 3) #endif @@ -62,9 +62,9 @@ _FORTIFY_FN(fmemopen) FILE *fmemopen(void* _FORTIFY_POS0 __b, size_t __s, const return __orig_fmemopen(__b, __s, __m); } -__access(read_only, 1) -__access(read_only, 2) -__malloc(malloc (pclose, 1)) +__fh_access(read_only, 1) +__fh_access(read_only, 2) +__fh_malloc(malloc (pclose, 1)) #if __has_builtin(__builtin_popen) __diagnose_as_builtin(__builtin_popen, 1, 2) #endif @@ -75,22 +75,22 @@ _FORTIFY_FN(popen) FILE *popen(const char* _FORTIFY_POS0 __c, const char* _FORTI #endif /* _POSIX_SOURCE || _POSIX_C_SOURCE || _XOPEN_SOURCE || _GNU_SOURCE || _BSD_SOURCE */ -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_fgets) __diagnose_as_builtin(__builtin_fgets, 1, 2, 3) #endif _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if ((__fh_size_t)__n > __b) __builtin_trap(); return __orig_fgets(__s, __n, __f); } -__access(read_only, 1) -__access(read_only, 2) -__malloc(malloc (fclose, 1)) +__fh_access(read_only, 1) +__fh_access(read_only, 2) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_fopen) __diagnose_as_builtin(__builtin_fopen, 1, 2) #endif @@ -99,14 +99,14 @@ _FORTIFY_FN(fopen) FILE *fopen(const char* _FORTIFY_POS0 __p, const char* _FORTI return __orig_fopen(__p, __m); } -__access(write_only, 1) +__fh_access(write_only, 1) #if __has_builtin(__builtin_fread) __diagnose_as_builtin(__builtin_fread, 1, 2, 3, 4) #endif _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__bmo(__n, __m)) __builtin_trap(); @@ -115,14 +115,14 @@ _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, return __orig_fread(__d, __n, __m, __f); } -__access(read_only, 1) +__fh_access(read_only, 1) #if __has_builtin(__builtin_fwrite) __diagnose_as_builtin(__builtin_fwrite, 1, 2, 3, 4) #endif _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__bmo(__n, __m)) __builtin_trap(); @@ -133,7 +133,7 @@ _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, #ifndef __clang__ /* FIXME */ #undef tmpfile -__malloc(malloc (fclose, 1)) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_tmpfile) __diagnose_as_builtin(__builtin_tmpfile) #endif @@ -143,9 +143,9 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) } #endif -__access(read_write, 1, 2) -__access(read_only, 3) -__format(printf, 3, 0) +__fh_access(read_write, 1, 2) +__fh_access(read_only, 3) +__fh_format(printf, 3, 0) #if __has_builtin(__builtin_vsnprintf) __diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4) #endif @@ -153,9 +153,9 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsnprintf_chk) && USE_NATIVE_CHK - return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); + return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __v); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); @@ -163,9 +163,9 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, #endif } -__format(printf, 2, 0) -__access(read_write, 1) -__access(read_only, 2) +__fh_format(printf, 2, 0) +__fh_access(read_write, 1) +__fh_access(read_only, 2) #if __has_builtin(__builtin_vsprintf) __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) #endif @@ -173,9 +173,9 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsprintf_chk) && USE_NATIVE_CHK - return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); + return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __v); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); int __r; if (__b != (__fh_size_t)-1) { @@ -193,8 +193,8 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, #undef vfprintf #undef vprintf -__access(read_only, 2) -__format(printf, 2, 0) +__fh_access(read_only, 2) +__fh_format(printf, 2, 0) #if __has_builtin(__builtin_vfprintf) __diagnose_as_builtin(__builtin_vfprintf, 2, 3) #endif @@ -207,8 +207,8 @@ _FORTIFY_FN(vfprintf) int vfprintf(FILE * __s, const char *__f, __builtin_va_lis #endif } -__access(read_only, 1) -__format(printf, 1, 0) +__fh_access(read_only, 1) +__fh_format(printf, 1, 0) #if __has_builtin(__builtin_vprintf) __diagnose_as_builtin(__builtin_vprintf, 1, 2) #endif @@ -248,16 +248,16 @@ _FORTIFY_FN(vprintf) int vprintf(const char *__f, __builtin_va_list __v) #undef printf #undef fprintf -__access(read_write, 1, 2) -__access(read_only, 3) -__format(printf, 3, 4) +__fh_access(read_write, 1, 2) +__fh_access(read_only, 3) +__fh_format(printf, 3, 4) _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, const char *__f, ...) { #if __has_builtin(__builtin___snprintf_chk) && USE_NATIVE_CHK - return __builtin___snprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __builtin_va_arg_pack()); + return __builtin___snprintf_chk(__s, __n, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __builtin_va_arg_pack()); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); @@ -265,15 +265,15 @@ _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, #endif } -__format(printf, 2, 3) -__access(read_write, 1) -__access(read_only, 2) +__fh_format(printf, 2, 3) +__fh_access(read_write, 1) +__fh_access(read_only, 2) _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) { #if __has_builtin(__builtin___sprintf_chk) && USE_NATIVE_CHK - return __builtin___sprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __builtin_va_arg_pack()); + return __builtin___sprintf_chk(__s, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __builtin_va_arg_pack()); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); int __r; if (__b != (__fh_size_t)-1) { @@ -287,8 +287,8 @@ _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) #endif } -__format(printf, 1, 2) -__access(read_only, 1) +__fh_format(printf, 1, 2) +__fh_access(read_only, 1) _FORTIFY_FN(printf) int printf(const char *__f, ...) { #if __has_builtin(__builtin___printf_chk) && USE_NATIVE_CHK @@ -298,8 +298,8 @@ _FORTIFY_FN(printf) int printf(const char *__f, ...) #endif } -__access(read_only, 2) -__format(printf, 2, 0) +__fh_access(read_only, 2) +__fh_format(printf, 2, 0) #if __has_builtin(__builtin_fprintf) __diagnose_as_builtin(__builtin_fprintf, 2, 3) #endif diff --git a/include/stdlib.h b/include/stdlib.h @@ -37,7 +37,7 @@ __diagnose_as_builtin(__builtin_mbstowcs, 1, 2, 3) _FORTIFY_FN(mbstowcs) size_t mbstowcs(wchar_t * _FORTIFY_POS0 __ws, const char *__s, size_t __wn) { - __fh_size_t __b = __bos(__ws, 0); + __fh_size_t __b = __fh_bos(__ws, 0); if (__ws && __wn > __b / sizeof(wchar_t)) __builtin_trap(); @@ -45,14 +45,14 @@ _FORTIFY_FN(mbstowcs) size_t mbstowcs(wchar_t * _FORTIFY_POS0 __ws, } #undef wcstombs -__access(write_only, 1, 3) +__fh_access(write_only, 1, 3) #if __has_builtin(__builtin_wcstombs) __diagnose_as_builtin(__builtin_wcstombs, 1, 2, 3) #endif _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, const wchar_t *__ws, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__s && __n > __b) __builtin_trap(); @@ -68,7 +68,7 @@ __diagnose_as_builtin(__builtin_wctomb, 1, 2) #endif _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__s && 16 > __b && MB_CUR_MAX > __b) __builtin_trap(); @@ -81,11 +81,11 @@ _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) #if __has_builtin(__builtin_qsort) __diagnose_as_builtin(__builtin_qsort, 1, 2, 3, 4) #endif -__access(read_write, 1) +__fh_access(read_write, 1) _FORTIFY_FN(qsort) void qsort(void * _FORTIFY_POS0 base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - __fh_size_t __b = __bos(base, 0); + __fh_size_t __b = __fh_bos(base, 0); if (__bmo(nmemb, size)) __builtin_trap(); @@ -101,8 +101,8 @@ _FORTIFY_FN(qsort) void qsort(void * _FORTIFY_POS0 base, size_t nmemb, size_t si #undef realloc #undef calloc -__malloc(malloc (free, 1)) -__alloc_size(1) +__fh_malloc(malloc (free, 1)) +__fh_alloc_size(1) __warn_unused_result #if __has_builtin(__builtin_malloc) __diagnose_as_builtin(__builtin_malloc, 1) @@ -112,7 +112,7 @@ _FORTIFY_FN(malloc) void *malloc(size_t __s) return __orig_malloc(__s); } -__alloc_size(2) +__fh_alloc_size(2) __warn_unused_result #if __has_builtin(__builtin_realloc) __diagnose_as_builtin(__builtin_realloc, 1, 2) @@ -122,7 +122,7 @@ _FORTIFY_FN(realloc) void *realloc(void *__p, size_t __s) return __orig_realloc(__p, __s); } -__alloc_size(1, 2) +__fh_alloc_size(1, 2) __warn_unused_result #if __has_builtin(__builtin_calloc) __diagnose_as_builtin(__builtin_calloc, 1, 2) @@ -134,7 +134,7 @@ _FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef reallocarray -__alloc_size (2, 3) +__fh_alloc_size (2, 3) __warn_unused_result #if __has_builtin(__builtin_reallocarray) __diagnose_as_builtin(__builtin_reallocarray, 1, 2, 3) @@ -154,7 +154,7 @@ __diagnose_as_builtin(__builtin_realpath, 1, 2) _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) { // PATH_MAX is defined as 4096 - if (__r && 4096 > __bos(__r, 2)) { + if (__r && 4096 > __fh_bos(__r, 2)) { char __buf[4096], *__ret; __fh_size_t __l; @@ -162,7 +162,7 @@ _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) if (!__ret) return NULL; __l = __builtin_strlen(__ret) + 1; - if (__l > __bos(__r, 0)) + if (__l > __fh_bos(__r, 0)) __builtin_trap(); __builtin_memcpy(__r, __ret, __l); return __r; diff --git a/include/string.h b/include/string.h @@ -39,20 +39,20 @@ extern "C" { #undef strncat #undef strncpy -__access(write_only, 1, 3) -__access(read_only, 2, 3) +__fh_access(write_only, 1, 3) +__fh_access(read_only, 2, 3) #if __has_builtin(__builtin_mempcpy) __diagnose_as_builtin(__builtin_memcpy, 1, 2, 3) #endif _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, const void * _FORTIFY_POS0 __os, size_t __n) -__error_if((__bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") +__error_if((__fh_bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") { #if __has_builtin(__builtin___memcpy_chk) && USE_NATIVE_CHK - return __builtin___memcpy_chk(__od, __os, __n, __bos(__od, 0)); + return __builtin___memcpy_chk(__od, __os, __n, __fh_bos(__od, 0)); #else - __fh_size_t __bd = __bos(__od, 0); - __fh_size_t __bs = __bos(__os, 0); + __fh_size_t __bd = __fh_bos(__od, 0); + __fh_size_t __bs = __fh_bos(__os, 0); char *__d = (char *)__od; const char *__s = (const char *)__os; @@ -64,8 +64,8 @@ __error_if((__bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the siz #endif } -__access(write_only, 1, 3) -__access(read_only, 2, 3) +__fh_access(write_only, 1, 3) +__fh_access(read_only, 2, 3) #if __has_builtin(__builtin_memmove) __diagnose_as_builtin(__builtin_memmove, 1, 2, 3) #endif @@ -73,10 +73,10 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, const void * _FORTIFY_POS0 __s, size_t __n) { #if __has_builtin(__builtin___memmove_chk) && USE_NATIVE_CHK - return __builtin___memmove_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___memmove_chk(__d, __s, __n, __fh_bos(__d, 0)); #else - __fh_size_t __bd = __bos(__d, 0); - __fh_size_t __bs = __bos(__s, 0); + __fh_size_t __bd = __fh_bos(__d, 0); + __fh_size_t __bs = __fh_bos(__s, 0); if (__n > __bd || __n > __bs) __builtin_trap(); @@ -84,7 +84,7 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, #endif } -__access(write_only, 1, 3) +__fh_access(write_only, 1, 3) #if __has_builtin(__builtin_memset) __diagnose_as_builtin(__builtin_memset, 1, 2, 3) #endif @@ -92,9 +92,9 @@ _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert the arguments?") { #if __has_builtin(__builtin___memset_chk) && USE_NATIVE_CHK - return __builtin___memset_chk(__d, __c, __n, __bos(__d, 0)); + return __builtin___memset_chk(__d, __c, __n, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); @@ -102,16 +102,16 @@ __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert #endif } -__access(read_only, 1, 3) +__fh_access(read_only, 1, 3) #if __has_builtin(__builtin_memchr) __diagnose_as_builtin(__builtin_memchr, 1, 2, 3) #endif _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) { #if __has_builtin(__builtin___memchr_chk) && USE_NATIVE_CHK - return __builtin___memchr_chk(__d, __c, __n, __bos(__d, 0)); + return __builtin___memchr_chk(__d, __c, __n, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); @@ -119,13 +119,13 @@ _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t #endif } -__access(read_only, 1, 2) +__fh_access(read_only, 1, 2) _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) { #if __has_builtin(__builtin___strchr_chk) && USE_NATIVE_CHK - return __builtin___strchr_chk(__s, __c, __bos(__s, 0)); + return __builtin___strchr_chk(__s, __c, __fh_bos(__s, 0)); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); char* __r = __builtin_strchr(__s, __c); if (__r - __s > __b) @@ -134,13 +134,13 @@ _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) #endif } -__access(read_only, 1, 2) +__fh_access(read_only, 1, 2) _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) { #if __has_builtin(__builtin___strrchr_chk) && USE_NATIVE_CHK - return __builtin___strrchr_chk(__s, __c, __bos(__s, 0)); + return __builtin___strrchr_chk(__s, __c, __fh_bos(__s, 0)); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); char* __r = __builtin_strrchr(__s, __c); if (__r - __s > __b) @@ -153,22 +153,22 @@ _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ || defined(_BSD_SOURCE) #undef stpcpy -__access(write_only, 1) -__access(read_only, 2) +__fh_access(write_only, 1) +__fh_access(read_only, 2) #if __has_builtin(__builtin_stpcpy) __diagnose_as_builtin(__builtin_stpcpy, 1, 2) #endif _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) { #if __has_builtin(__builtin___stpcpy_chk) && USE_NATIVE_CHK - return __builtin___stpcpy_chk(__d, __s, __bos(__d, 0)); + return __builtin___stpcpy_chk(__d, __s, __fh_bos(__d, 0)); #else __fh_size_t __n = strlen(__s) + 1; if (__fh_overlap(__d, __s, __n)) __builtin_trap(); - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); return __orig_stpcpy(__d, __s); @@ -176,8 +176,8 @@ _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) } #undef stpncpy -__access(write_only, 1) -__access(read_only, 2, 3) +__fh_access(write_only, 1) +__fh_access(read_only, 2, 3) #if __has_builtin(__builtin_stpncpy) __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) #endif @@ -185,12 +185,12 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { #if __has_builtin(__builtin___stpncpy_chk) && USE_NATIVE_CHK - return __builtin___stpncpy_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); #else if (__fh_overlap(__d, __s, __n)) __builtin_trap(); - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b && strlen(__s) + 1 > __b) __builtin_trap(); return __orig_stpncpy(__d, __s, __n); @@ -198,17 +198,17 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, } #endif -__access (read_write, 1) -__access (read_only, 2) +__fh_access (read_write, 1) +__fh_access (read_only, 2) #if __has_builtin(__builtin_strcat) __diagnose_as_builtin(__builtin_strcat, 1, 2) #endif _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) { #if __has_builtin(__builtin___strcat_chk) && USE_NATIVE_CHK - return __builtin___strcat_chk(__d, __s, __bos(__d, 0)); + return __builtin___strcat_chk(__d, __s, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (strlen(__s) + strlen(__d) + 1 > __b) __builtin_trap(); @@ -216,46 +216,46 @@ _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) #endif } -__access (write_only, 1) -__access (read_only, 2) +__fh_access (write_only, 1) +__fh_access (read_only, 2) #if __has_builtin(__builtin_strcpy) __diagnose_as_builtin(__builtin_strcpy, 1, 2) #endif _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) { #if __has_builtin(__builtin___strcpy_chk) && USE_NATIVE_CHK - return __builtin___strcpy_chk(__d, __s, __bos(__d, 0)); + return __builtin___strcpy_chk(__d, __s, __fh_bos(__d, 0)); #else __fh_size_t __n = strlen(__s) + 1; if (__fh_overlap(__d, __s, __n)) __builtin_trap(); - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); return __orig_strcpy(__d, __s); #endif } -__access (read_only, 1) +__fh_access (read_only, 1) #if __has_builtin(__builtin_strlen) __diagnose_as_builtin(__builtin_strlen, 1) #endif _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) { #if __has_builtin(__builtin___strlen_chk) && USE_NATIVE_CHK - return __builtin___strlen_chk(__s, __bos(__s, 0)); + return __builtin___strlen_chk(__s, __fh_bos(__s, 0)); #else __fh_size_t ret = __orig_strlen(__s); - if (ret > __bos(__s, 0) - 1) + if (ret > __fh_bos(__s, 0) - 1) __builtin_trap(); return ret; #endif } -__access (read_write, 1) -__access (read_only, 2, 3) +__fh_access (read_write, 1) +__fh_access (read_only, 2, 3) #if __has_builtin(__builtin_strncat) __diagnose_as_builtin(__builtin_strncat, 1, 2, 3) #endif @@ -263,9 +263,9 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { #if __has_builtin(__builtin___strncat_chk) && USE_NATIVE_CHK - return __builtin___strncat_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) { __fh_size_t __sl = strnlen(__s, __n); @@ -277,8 +277,8 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, #endif } -__access (write_only, 1) -__access (read_only, 2, 3) +__fh_access (write_only, 1) +__fh_access (read_only, 2, 3) #if __has_builtin(__builtin_strncpy) __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) #endif @@ -286,12 +286,12 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { #if __has_builtin(__builtin___strncpy_chk) && USE_NATIVE_CHK - return __builtin___strncpy_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); #else if (__fh_overlap(__d, __s, __n)) __builtin_trap(); - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); return __orig_strncpy(__d, __s, __n); @@ -300,8 +300,8 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, #ifdef _GNU_SOURCE #undef mempcpy -__access(write_only, 1) -__access(read_only, 2, 3) +__fh_access(write_only, 1) +__fh_access(read_only, 2, 3) #if __has_builtin(__builtin_mempcpy) __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) #endif @@ -309,10 +309,10 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, const void * _FORTIFY_POS0 __s, size_t __n) { #if __has_builtin(__builtin___mempcpy_chk) && USE_NATIVE_CHK - return __builtin___mempcpy_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); #else - __fh_size_t __bd = __bos(__d, 0); - __fh_size_t __bs = __bos(__s, 0); + __fh_size_t __bd = __fh_bos(__d, 0); + __fh_size_t __bs = __fh_bos(__s, 0); if (__n > __bd || __n > __bs) __builtin_trap(); @@ -324,8 +324,8 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef strlcat #undef strlcpy -__access (read_write, 1) -__access (read_only, 2, 3) +__fh_access (read_write, 1) +__fh_access (read_only, 2, 3) #if __has_builtin(__builtin_strlcat) __diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) #endif @@ -333,9 +333,9 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { #if __has_builtin(__builtin___strlcat_chk) && USE_NATIVE_CHK - return __builtin___strlcat_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___strlcat_chk(__d, __s, __n, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); @@ -343,8 +343,8 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, #endif } -__access (write_only, 1) -__access (read_only, 2, 3) +__fh_access (write_only, 1) +__fh_access (read_only, 2, 3) #if __has_builtin(__builtin_strlcpy) __diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) #endif @@ -352,9 +352,9 @@ _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { #if __has_builtin(__builtin___strlcpy_chk) && USE_NATIVE_CHK - return __builtin___strlcpy_chk(__d, __s, __n, __bos(__d, 0)); + return __builtin___strlcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); #else - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b) __builtin_trap(); diff --git a/include/strings.h b/include/strings.h @@ -31,8 +31,8 @@ extern "C" { || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) #undef bcopy #undef bzero -__access(write_only, 2, 3) -__access(read_only, 1, 3) +__fh_access(write_only, 2, 3) +__fh_access(read_only, 1, 3) #if __has_builtin(__builtin_bcopy) && !defined(__clang__) // parameter 1 of function '__orig_bcopy' has type 'const void *', but parameter 1 of function '__builtin_bcopy' has type 'void *' __diagnose_as_builtin(__builtin_bcopy, 1, 2, 3) @@ -40,21 +40,21 @@ __diagnose_as_builtin(__builtin_bcopy, 1, 2, 3) _FORTIFY_FN(bcopy) void bcopy(const void * _FORTIFY_POS0 __s, void * _FORTIFY_POS0 __d, size_t __n) { - __fh_size_t __bd = __bos(__d, 0); - __fh_size_t __bs = __bos(__s, 0); + __fh_size_t __bd = __fh_bos(__d, 0); + __fh_size_t __bs = __fh_bos(__s, 0); if (__n > __bd || __n > __bs) __builtin_trap(); return __orig_bcopy(__s, __d, __n); } -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_bzero) __diagnose_as_builtin(__builtin_bzero, 1, 2) #endif _FORTIFY_FN(bzero) void bzero(void * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); diff --git a/include/sys/select.h b/include/sys/select.h @@ -34,7 +34,7 @@ extern "C" { _STI void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_POS0 __s) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__f < 0 || __f >= FD_SETSIZE || __b < sizeof(fd_set)) __builtin_trap(); @@ -43,7 +43,7 @@ _STI void __fortify_FD_CLR(int __f, fd_set * _FORTIFY_POS0 __s) _STI void __fortify_FD_SET(int __f, fd_set * _FORTIFY_POS0 __s) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__f < 0 || __f >= FD_SETSIZE || __b < sizeof(fd_set)) __builtin_trap(); @@ -52,7 +52,7 @@ _STI void __fortify_FD_SET(int __f, fd_set * _FORTIFY_POS0 __s) _STI int __fortify_FD_ISSET(int __f, fd_set * _FORTIFY_POS0 __s) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__f < 0 || __f >= FD_SETSIZE || __b < sizeof(fd_set)) __builtin_trap(); diff --git a/include/sys/socket.h b/include/sys/socket.h @@ -34,46 +34,46 @@ extern "C" { #undef send #undef sendto -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) _FORTIFY_FN(recv) ssize_t recv(int __f, void * _FORTIFY_POS0 __s, size_t __n, int __fl) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_recv(__f, __s, __n, __fl); } -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) _FORTIFY_FN(recvfrom) ssize_t recvfrom(int __f, void * _FORTIFY_POS0 __s, size_t __n, int __fl, struct sockaddr *__a, socklen_t *__l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_recvfrom(__f, __s, __n, __fl, __a, __l); } -__access(read_only, 2, 3) +__fh_access(read_only, 2, 3) _FORTIFY_FN(send) ssize_t send(int __f, const void * _FORTIFY_POS0 __s, size_t __n, int __fl) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_send(__f, __s, __n, __fl); } -__access(read_only, 2, 3) +__fh_access(read_only, 2, 3) _FORTIFY_FN(sendto) ssize_t sendto(int __f, const void * _FORTIFY_POS0 __s, size_t __n, int __fl, const struct sockaddr *__a, socklen_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); diff --git a/include/unistd.h b/include/unistd.h @@ -41,13 +41,13 @@ extern "C" { #undef ttyname_r #undef write -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) #if __has_builtin(__builtin_confstr) __diagnose_as_builtin(__builtin_confstr, 1, 2, 3) #endif _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); __fh_size_t __r = __orig_confstr(__n, __s, __b > __l ? __l : __b); if (__l > __b && __r > __b) @@ -55,13 +55,13 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __ return __r; } -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_getcwd) __diagnose_as_builtin(__builtin_getcwd, 1, 2) #endif _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__l > __b) __builtin_trap(); @@ -70,13 +70,13 @@ _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef getdomainname -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_getdomainname) __diagnose_as_builtin(__builtin_getdomainname, 1, 2) #endif _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__l > __b) __builtin_trap(); @@ -89,33 +89,33 @@ __diagnose_as_builtin(__builtin_getgroups, 1, 2) #endif _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__l > 0 && (unsigned)__l > __b / sizeof(gid_t)) __builtin_trap(); return __orig_getgroups(__l, __s); } -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_gethostname) __diagnose_as_builtin(__builtin_gethostname, 1, 2) #endif _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__l > __b) __builtin_trap(); return __orig_gethostname(__s, __l); } -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_getlogin_r) __diagnose_as_builtin(__builtin_getlogin_r, 1, 2) #endif _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__l > __b) __builtin_trap(); @@ -128,76 +128,76 @@ __diagnose_as_builtin(__builtin_pread, 1, 2, 3, 4) _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s, size_t __n, off_t __o) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_pread(__f, __s, __n, __o); } -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) #if __has_builtin(__builtin_read) __diagnose_as_builtin(__builtin_read, 1, 2, 3) #endif _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_read(__f, __s, __n); } -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) #if __has_builtin(__builtin_readlink) __diagnose_as_builtin(__builtin_readlink, 1, 2, 3) #endif _FORTIFY_FN(readlink) ssize_t readlink(const char *__p, char * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_readlink(__p, __s, __n); } -__access(write_only, 3, 4) +__fh_access(write_only, 3, 4) #if __has_builtin(__builtin_readlinkat) __diagnose_as_builtin(__builtin_readlinkat, 1, 2, 3, 4) #endif _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, char * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_readlinkat(__f, __p, __s, __n); } -__access(write_only, 2, 3) +__fh_access(write_only, 2, 3) #if __has_builtin(__builtin_ttyname_r) __diagnose_as_builtin(__builtin_ttyname_r, 1, 2, 3) #endif _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); return __orig_ttyname_r(__f, __s, __n); } -__access(read_only, 2, 3) +__fh_access(read_only, 2, 3) #if __has_builtin(__builtin_write) __diagnose_as_builtin(__builtin_write, 1, 2, 3) #endif _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); @@ -210,7 +210,7 @@ __diagnose_as_builtin(__builtin_pwrite, 1, 2, 3, 4) _FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s, size_t __n, off_t __o) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); diff --git a/include/wchar.h b/include/wchar.h @@ -47,7 +47,7 @@ __diagnose_as_builtin(__builtin_fgetws, 1, 2, 3) _FORTIFY_FN(fgetws) wchar_t *fgetws(wchar_t * _FORTIFY_POS0 __s, int __n, FILE *__f) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if ((__fh_size_t)__n > __b / sizeof(wchar_t)) __builtin_trap(); @@ -64,7 +64,7 @@ _FORTIFY_FN(mbsnrtowcs) size_t mbsnrtowcs(wchar_t * _FORTIFY_POS0 __d, const char **__s, size_t __n, size_t __wn, mbstate_t *__st) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); __fh_size_t __r; if (__wn > __n / sizeof(wchar_t)) { @@ -88,7 +88,7 @@ _FORTIFY_FN(mbsrtowcs) size_t mbsrtowcs(wchar_t * _FORTIFY_POS0 __d, const char **__s, size_t __wn, mbstate_t *__st) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); __fh_size_t __r; __b /= sizeof(wchar_t); @@ -106,14 +106,14 @@ __diagnose_as_builtin(__builtin_wcrtomb, 1, 2, 3) _FORTIFY_FN(wcrtomb) size_t wcrtomb(char * __s, wchar_t __w, mbstate_t *__st) { // In glibc, MB_LEN_MAX is typically 16 (6 in glibc versions earlier than 2.2) - if (__s && 16 > __bos(__s, 2)) { + if (__s && 16 > __fh_bos(__s, 2)) { char __buf[16]; __fh_size_t __r; __r = __orig_wcrtomb(__buf, __w, __st); if (__r == (__fh_size_t)-1) return __r; - if (__r > __bos(__s, 0)) + if (__r > __fh_bos(__s, 0)) __builtin_trap(); __builtin_memcpy(__s, __buf, __r); return __r; @@ -128,7 +128,7 @@ __diagnose_as_builtin(__builtin_wcscat, 1, 2) _FORTIFY_FN(wcscat) wchar_t *wcscat(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (wcslen(__s) + wcslen(__d) + 1 > __b / sizeof(wchar_t)) __builtin_trap(); @@ -141,7 +141,7 @@ __diagnose_as_builtin(__builtin_wcscpy, 1, 2) _FORTIFY_FN(wcscpy) wchar_t *wcscpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (wcslen(__s) + 1 > __b / sizeof(wchar_t)) __builtin_trap(); @@ -154,7 +154,7 @@ __diagnose_as_builtin(__builtin_wcsncat, 1, 2, 3) _FORTIFY_FN(wcsncat) wchar_t *wcsncat(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); __fh_size_t __sl, __dl; if (__n > __b / sizeof(wchar_t)) { @@ -174,7 +174,7 @@ __diagnose_as_builtin(__builtin_wcsncpy, 1, 2, 3) _FORTIFY_FN(wcsncpy) wchar_t *wcsncpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b / sizeof(wchar_t)) __builtin_trap(); @@ -191,7 +191,7 @@ _FORTIFY_FN(wcsnrtombs) size_t wcsnrtombs(char * _FORTIFY_POS0 __d, const wchar_t **__s, size_t __wn, size_t __n, mbstate_t *__st) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); __fh_size_t __r; if (__wn > __n / sizeof(wchar_t)) { @@ -215,7 +215,7 @@ _FORTIFY_FN(wcsrtombs) size_t wcsrtombs(char * _FORTIFY_POS0 __d, const wchar_t **__s, size_t __n, mbstate_t *__st) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); __fh_size_t __r; __r = __orig_wcsrtombs(__d, __s, __n > __b ? __b : __n, __st); @@ -230,7 +230,7 @@ __diagnose_as_builtin(__builtin_wmemcpy, 1, 2, 3) _FORTIFY_FN(wmemcpy) wchar_t *wmemcpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b / sizeof(wchar_t)) __builtin_trap(); @@ -243,7 +243,7 @@ __diagnose_as_builtin(__builtin_wmemmove, 1, 2, 3) _FORTIFY_FN(wmemmove) wchar_t *wmemmove(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__n > __b / sizeof(wchar_t)) __builtin_trap(); @@ -256,7 +256,7 @@ __diagnose_as_builtin(__builtin_wmemset, 1, 2, 3) _FORTIFY_FN(wmemset) wchar_t *wmemset(wchar_t * _FORTIFY_POS0 __s, wchar_t __c, size_t __n) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b / sizeof(wchar_t)) __builtin_trap();