summaryrefslogtreecommitdiff
path: root/include/stdio.h
diff options
context:
space:
mode:
authorjvoisin2025-11-14 15:06:23 +0100
committerjvoisin2025-11-14 16:56:09 +0100
commite9b6cb7e2eb7029902ae92ef43fb905e5072785b (patch)
tree81a2faba510f23858c8fba80c2345227be4e8e3b /include/stdio.h
parentbf242b15e1f7873bdb940c2441b5e57747bc2f81 (diff)
Add `format` annotations
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 67738ed..aebe861 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -76,6 +76,7 @@ _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n,
76 return __orig_fwrite(__d, __n, __m, __f); 76 return __orig_fwrite(__d, __n, __m, __f);
77} 77}
78 78
79__format(printf, 3, 0)
79__access(write_only, 1, 2) 80__access(write_only, 1, 2)
80__access(read_only, 3) 81__access(read_only, 3)
81_FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, 82_FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
@@ -88,6 +89,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
88 return __orig_vsnprintf(__s, __n, __f, __v); 89 return __orig_vsnprintf(__s, __n, __f, __v);
89} 90}
90 91
92__format(printf, 2, 0)
91__access(write_only, 1) 93__access(write_only, 1)
92__access(read_only, 2) 94__access(read_only, 2)
93_FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, 95_FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f,
@@ -121,6 +123,7 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f,
121 * 3) not implementing these under clang, which is what we do for now 123 * 3) not implementing these under clang, which is what we do for now
122 */ 124 */
123 125
126__format(printf, 3, 4)
124_FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, 127_FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n,
125 const char *__f, ...) 128 const char *__f, ...)
126{ 129{
@@ -131,6 +134,7 @@ _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n,
131 return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack()); 134 return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
132} 135}
133 136
137__format(printf, 2, 3)
134_FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) 138_FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...)
135{ 139{
136 size_t __b = __bos(__s, 0); 140 size_t __b = __bos(__s, 0);