fortify-headers

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

commit bfbaa577f6fc46ebb965724e0f261e79e26ec9fb
parent d6afda7207b7a8a144923ab5813d8a0816813907
Author: jvoisin <julien.voisin@dustri.org>
Date:   Sun, 20 Aug 2023 20:50:31 +0200

Make use of __diagnose_as_builtin

Diffstat:
Minclude/fortify-headers.h | 5+++++
Minclude/poll.h | 2++
Minclude/stdio.h | 9+++++++++
Minclude/stdlib.h | 5+++++
Minclude/string.h | 15+++++++++++++++
Minclude/strings.h | 2++
Minclude/unistd.h | 12++++++++++++
Minclude/wchar.h | 16++++++++++++++++
8 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/include/fortify-headers.h b/include/fortify-headers.h @@ -93,6 +93,11 @@ #define __alloc_size(...) #endif +#if __has_attribute (__diagnose_as_builtin) +#define __diagnose_as_builtin(...) __attribute__ ((__diagnose_as_builtin (__VA_ARGS__))) +#else +#define __diagnose_as_builtin(...) +#endif #endif /* __has_attribute */ diff --git a/include/poll.h b/include/poll.h @@ -31,6 +31,7 @@ extern "C" { #undef poll +__diagnose_as_builtin(__builtin_pollfd, 1, 2, 3) _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __s) { size_t __b = __bos(__f, 0); @@ -42,6 +43,7 @@ _FORTIFY_FN(poll) int poll(struct pollfd * _FORTIFY_POS0 __f, nfds_t __n, int __ #if defined(_GNU_SOURCE) && !_REDIR_TIME64 #undef ppoll +__diagnose_as_builtin(__builtin_ppollfd, 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) { diff --git a/include/stdio.h b/include/stdio.h @@ -42,12 +42,14 @@ extern "C" { #undef vsprintf __access(read_only, 2) +__diagnose_as_builtin(__builtin_fdopen, 1, 2) _FORTIFY_FN(fdopen) FILE *fdopen(int __f, const char* _FORTIFY_POS0 __m) { return __orig_fdopen(__f, __m); } __access(write_only, 1, 2) +__diagnose_as_builtin(__builtin_fgets, 1, 2, 3) _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f) { size_t __b = __bos(__s, 0); @@ -58,6 +60,7 @@ _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f) } __malloc(malloc (fclose, 1)) +__diagnose_as_builtin(__builtin_fmemopen, 1, 2, 3) _FORTIFY_FN(fmemopen) FILE *fmemopen(void* _FORTIFY_POS0 __b, size_t __s, const char* _FORTIFY_POS0 __m) { return __orig_fmemopen(__b, __s, __m); @@ -66,12 +69,14 @@ _FORTIFY_FN(fmemopen) FILE *fmemopen(void* _FORTIFY_POS0 __b, size_t __s, const __access(read_only, 1) __access(read_only, 2) __malloc(malloc (fclose, 1)) +__diagnose_as_builtin(__builtin_fopen, 1, 2) _FORTIFY_FN(fopen) FILE *fopen(const char* _FORTIFY_POS0 __p, const char* _FORTIFY_POS0 __m) { return __orig_fopen(__p, __m); } __access(write_only, 1) +__diagnose_as_builtin(__builtin_fread, 1, 2, 3, 4) _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { @@ -85,6 +90,7 @@ _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, } __access(read_only, 1) +__diagnose_as_builtin(__builtin_fwrite, 1, 2, 3, 4) _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { @@ -98,6 +104,7 @@ _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, } __malloc(malloc (pclose, 1)) +__diagnose_as_builtin(__builtin_fwrite, 1, 2) _FORTIFY_FN(popen) FILE *popen(const char* _FORTIFY_POS0 __c, const char* _FORTIFY_POS0 __t) { return __orig_popen(__c, __t); @@ -113,6 +120,7 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) #endif __access(read_write, 1, 2) +__diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4) _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, const char *__f, __builtin_va_list __v) { @@ -123,6 +131,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, return __orig_vsnprintf(__s, __n, __f, __v); } +__diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, __builtin_va_list __v) { diff --git a/include/stdlib.h b/include/stdlib.h @@ -42,18 +42,21 @@ extern "C" { __malloc(malloc (free, 1)) __alloc_size(1) +__diagnose_as_builtin(__builtin_malloc, 1) _FORTIFY_FN(malloc) void *malloc(size_t __s) { return __orig_malloc(__s); } __alloc_size(2) +__diagnose_as_builtin(__builtin_realloc, 1, 2) _FORTIFY_FN(realloc) void *realloc(void *__p, size_t __s) { return __orig_realloc(__p, __s); } __alloc_size(1, 2) +__diagnose_as_builtin(__builtin_calloc, 1, 2) _FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s) { return __orig_calloc(__n, __s); @@ -62,6 +65,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) +__diagnose_as_builtin(__builtin_reallocarray, 1, 2, 3) _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) { return __orig_reallocarray(__p, __n, __s); @@ -71,6 +75,7 @@ _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) /* FIXME clang */ #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) #undef realpath +__diagnose_as_builtin(__builtin_realpath, 1, 2) _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) { #ifndef PATH_MAX diff --git a/include/string.h b/include/string.h @@ -40,6 +40,7 @@ extern "C" { __access(write_only, 1, 3) __access(read_only, 2, 3) +__diagnose_as_builtin(__builtin_memcpy, 1, 2, 3) _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, const void * _FORTIFY_POS0 __os, size_t __n) { @@ -60,6 +61,7 @@ _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, __access(write_only, 1, 3) __access(read_only, 2, 3) +__diagnose_as_builtin(__builtin_memmove, 1, 2, 3) _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, const void * _FORTIFY_POS0 __s, size_t __n) { @@ -72,6 +74,7 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, } __access(write_only, 1, 3) +__diagnose_as_builtin(__builtin_memset, 1, 2, 3) _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) { size_t __b = __bos(__d, 0); @@ -82,6 +85,7 @@ _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) } __access(read_only, 1, 3) +__diagnose_as_builtin(__builtin_memchr, 1, 2, 3) _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) { size_t __b = __bos(__d, 0); @@ -92,6 +96,7 @@ _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t } __access(read_only, 1, 2) +__diagnose_as_builtin(__builtin_strchr, 1, 2, 3) _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) { size_t __b = __bos(__s, 0); @@ -103,6 +108,7 @@ _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) } __access(read_only, 1, 2) +__diagnose_as_builtin(__builtin_strrchr, 1, 2, 3) _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) { size_t __b = __bos(__s, 0); @@ -119,6 +125,7 @@ _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) #undef stpcpy __access(write_only, 1) __access(read_only, 2) +__diagnose_as_builtin(__builtin_stpcpy, 1, 2) _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) { size_t __n = strlen(__s) + 1; @@ -138,6 +145,7 @@ _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) #undef stpncpy __access(write_only, 1) __access(read_only, 2, 3) +__diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { @@ -156,6 +164,7 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, __access (read_write, 1) __access (read_only, 2) +__diagnose_as_builtin(__builtin_strcat, 1, 2) _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) { size_t __b = __bos(__d, 0); @@ -167,6 +176,7 @@ _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) __access (write_only, 1) __access (read_only, 2) +__diagnose_as_builtin(__builtin_strcpy, 1, 2) _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) { size_t __n = strlen(__s) + 1; @@ -185,6 +195,7 @@ _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) __access (read_write, 1) __access (read_only, 2, 3) +__diagnose_as_builtin(__builtin_strncat, 1, 2, 3) _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { @@ -203,6 +214,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, __access (write_only, 1) __access (read_only, 2, 3) +__diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { @@ -222,6 +234,7 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, #undef mempcpy __access(write_only, 1) __access(read_only, 2, 3) +__diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, const void * _FORTIFY_POS0 __s, size_t __n) { @@ -239,6 +252,7 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, #undef strlcpy __access (read_write, 1) __access (read_only, 2, 3) +__diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { @@ -251,6 +265,7 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, __access (write_only, 1) __access (read_only, 2, 3) +__diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, const char *__s, size_t __n) { diff --git a/include/strings.h b/include/strings.h @@ -33,6 +33,7 @@ extern "C" { #undef bzero __access(write_only, 2, 3) __access(read_only, 1, 3) +__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) { @@ -45,6 +46,7 @@ _FORTIFY_FN(bcopy) void bcopy(const void * _FORTIFY_POS0 __s, } __access(write_only, 1, 2) +__diagnose_as_builtin(__builtin_bzero, 1, 2) _FORTIFY_FN(bzero) void bzero(void * _FORTIFY_POS0 __s, size_t __n) { size_t __b = __bos(__s, 0); diff --git a/include/unistd.h b/include/unistd.h @@ -42,6 +42,7 @@ extern "C" { #undef write __access(write_only, 2, 3) +__diagnose_as_builtin(__builtin_confstr, 1, 2, 3) _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) { size_t __b = __bos(__s, 0); @@ -53,6 +54,7 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __ } __access(write_only, 1, 2) +__diagnose_as_builtin(__builtin_getcwd, 1, 2) _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) { size_t __b = __bos(__s, 0); @@ -65,6 +67,7 @@ _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) +__diagnose_as_builtin(__builtin_getdomainname, 1, 2) _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) { size_t __b = __bos(__s, 0); @@ -75,6 +78,7 @@ _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __ } #endif +__diagnose_as_builtin(__builtin_getgroups, 1, 2) _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) { size_t __b = __bos(__s, 0); @@ -85,6 +89,7 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) } __access(write_only, 1, 2) +__diagnose_as_builtin(__builtin_gethostname, 1, 2) _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) { size_t __b = __bos(__s, 0); @@ -95,6 +100,7 @@ _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) } __access(write_only, 1, 2) +__diagnose_as_builtin(__builtin_getlogin_r, 1, 2) _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) { size_t __b = __bos(__s, 0); @@ -104,6 +110,7 @@ _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) return __orig_getlogin_r(__s, __l); } +__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) { @@ -115,6 +122,7 @@ _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s, } __access(write_only, 2, 3) +__diagnose_as_builtin(__builtin_read, 1, 2, 3) _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) { size_t __b = __bos(__s, 0); @@ -125,6 +133,7 @@ _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) } __access(write_only, 2, 3) +__diagnose_as_builtin(__builtin_readlink, 1, 2, 3) _FORTIFY_FN(readlink) ssize_t readlink(const char *__p, char * _FORTIFY_POS0 __s, size_t __n) { @@ -136,6 +145,7 @@ _FORTIFY_FN(readlink) ssize_t readlink(const char *__p, } __access(write_only, 3, 4) +__diagnose_as_builtin(__builtin_readlinkat, 1, 2, 3, 4) _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, char * _FORTIFY_POS0 __s, size_t __n) { @@ -147,6 +157,7 @@ _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, } __access(write_only, 2, 3) +__diagnose_as_builtin(__builtin_ttyname_r, 1, 2, 3) _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, size_t __n) { @@ -158,6 +169,7 @@ _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, } __access(read_only, 2, 3) +__diagnose_as_builtin(__builtin_write, 1, 2, 3) _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, size_t __n) { diff --git a/include/wchar.h b/include/wchar.h @@ -56,6 +56,7 @@ extern "C" { #undef wmemmove #undef wmemset +__diagnose_as_builtin(__builtin_fgetws, 1, 2, 3) _FORTIFY_FN(fgetws) wchar_t *fgetws(wchar_t * _FORTIFY_POS0 __s, int __n, FILE *__f) { @@ -69,6 +70,7 @@ _FORTIFY_FN(fgetws) wchar_t *fgetws(wchar_t * _FORTIFY_POS0 __s, #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef mbsnrtowcs +__diagnose_as_builtin(__builtin_mbsnrtowcs, 1, 2, 3, 4, 5) _FORTIFY_FN(mbsnrtowcs) size_t mbsnrtowcs(wchar_t * _FORTIFY_POS0 __d, const char **__s, size_t __n, size_t __wn, mbstate_t *__st) @@ -90,6 +92,7 @@ _FORTIFY_FN(mbsnrtowcs) size_t mbsnrtowcs(wchar_t * _FORTIFY_POS0 __d, } #endif +__diagnose_as_builtin(__builtin_mbsrtowcs, 1, 2, 3, 4) _FORTIFY_FN(mbsrtowcs) size_t mbsrtowcs(wchar_t * _FORTIFY_POS0 __d, const char **__s, size_t __wn, mbstate_t *__st) @@ -104,6 +107,7 @@ _FORTIFY_FN(mbsrtowcs) size_t mbsrtowcs(wchar_t * _FORTIFY_POS0 __d, return __r; } +__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) { @@ -116,6 +120,7 @@ _FORTIFY_FN(mbstowcs) size_t mbstowcs(wchar_t * _FORTIFY_POS0 __ws, /* FIXME clang */ #ifndef __clang__ +__diagnose_as_builtin(__builtin_wcrtomb, 1, 2, 3) _FORTIFY_FN(wcrtomb) size_t wcrtomb(char * __s, wchar_t __w, mbstate_t *__st) { if (__s && MB_LEN_MAX > __bos(__s, 2)) { @@ -134,6 +139,7 @@ _FORTIFY_FN(wcrtomb) size_t wcrtomb(char * __s, wchar_t __w, mbstate_t *__st) } #endif +__diagnose_as_builtin(__builtin_wcscat, 1, 2) _FORTIFY_FN(wcscat) wchar_t *wcscat(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s) { @@ -144,6 +150,7 @@ _FORTIFY_FN(wcscat) wchar_t *wcscat(wchar_t * _FORTIFY_POS0 __d, return __orig_wcscat(__d, __s); } +__diagnose_as_builtin(__builtin_wcscpy, 1, 2) _FORTIFY_FN(wcscpy) wchar_t *wcscpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s) { @@ -154,6 +161,7 @@ _FORTIFY_FN(wcscpy) wchar_t *wcscpy(wchar_t * _FORTIFY_POS0 __d, return __orig_wcscpy(__d, __s); } +__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) { @@ -171,6 +179,7 @@ _FORTIFY_FN(wcsncat) wchar_t *wcsncat(wchar_t * _FORTIFY_POS0 __d, return __orig_wcsncat(__d, __s, __n); } +__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) { @@ -184,6 +193,7 @@ _FORTIFY_FN(wcsncpy) wchar_t *wcsncpy(wchar_t * _FORTIFY_POS0 __d, #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef wcsnrtombs +__diagnose_as_builtin(__builtin_wcsntombs, 1, 2, 3, 4, 5) _FORTIFY_FN(wcsnrtombs) size_t wcsnrtombs(char * _FORTIFY_POS0 __d, const wchar_t **__s, size_t __wn, size_t __n, mbstate_t *__st) @@ -205,6 +215,7 @@ _FORTIFY_FN(wcsnrtombs) size_t wcsnrtombs(char * _FORTIFY_POS0 __d, } #endif +__diagnose_as_builtin(__builtin_wcsrtombs, 1, 2, 3, 4) _FORTIFY_FN(wcsrtombs) size_t wcsrtombs(char * _FORTIFY_POS0 __d, const wchar_t **__s, size_t __n, mbstate_t *__st) @@ -219,6 +230,7 @@ _FORTIFY_FN(wcsrtombs) size_t wcsrtombs(char * _FORTIFY_POS0 __d, } __access(write_only, 2, 3) +__diagnose_as_builtin(__builtin_wcstombs, 1, 2, 3) _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, const wchar_t *__ws, size_t __n) { @@ -229,6 +241,7 @@ _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, return __orig_wcstombs(__s, __ws, __n); } +__diagnose_as_builtin(__builtin_wctomb, 1, 2) _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) { size_t __b = __bos(__s, 0); @@ -238,6 +251,7 @@ _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) return __orig_wctomb(__s, __w); } +__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) { @@ -248,6 +262,7 @@ _FORTIFY_FN(wmemcpy) wchar_t *wmemcpy(wchar_t * _FORTIFY_POS0 __d, return __orig_wmemcpy(__d, __s, __n); } +__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) { @@ -258,6 +273,7 @@ _FORTIFY_FN(wmemmove) wchar_t *wmemmove(wchar_t * _FORTIFY_POS0 __d, return __orig_wmemmove(__d, __s, __n); } +__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) {