diff options
| author | jvoisin | 2025-11-14 15:06:23 +0100 |
|---|---|---|
| committer | jvoisin | 2025-11-14 16:56:09 +0100 |
| commit | e9b6cb7e2eb7029902ae92ef43fb905e5072785b (patch) | |
| tree | 81a2faba510f23858c8fba80c2345227be4e8e3b /include/stdio.h | |
| parent | bf242b15e1f7873bdb940c2441b5e57747bc2f81 (diff) | |
Add `format` annotations
Diffstat (limited to 'include/stdio.h')
| -rw-r--r-- | include/stdio.h | 4 |
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); |
