fortify-headers

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

commit 8802b2375ff7f9bf45fb316228e0349dc8d93d2d
parent 737b5207e12bb12a270fa1a385048fcf55617e43
Author: jvoisin <julien.voisin@dustri.org>
Date:   Sun, 20 Aug 2023 21:45:55 +0200

Add two __format annotations

Diffstat:
Minclude/stdio.h | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h @@ -36,8 +36,6 @@ extern "C" { #undef fread #undef fwrite #undef popen -#undef snprintf -#undef sprintf #undef vsnprintf #undef vsprintf @@ -120,6 +118,7 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) #endif __access(read_write, 1, 2) +__format(printf, 3, 0) __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) @@ -131,6 +130,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, return __orig_vsnprintf(__s, __n, __f, __v); } +__format(printf, 2, 0) __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, __builtin_va_list __v) @@ -163,6 +163,9 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, * 3) not implementing these under clang, which is what we do for now */ +#undef snprintf +#undef sprintf + __access(read_write, 1, 2) __format(printf, 3, 4) _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n,