summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/fortify-headers.h11
-rw-r--r--include/stdio.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
index a9b7498..deff351 100644
--- a/include/fortify-headers.h
+++ b/include/fortify-headers.h
@@ -70,4 +70,15 @@
70#define __access(...) 70#define __access(...)
71#endif 71#endif
72 72
73/* This needs to be two different conditions: https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html */
74#if defined __has_attribute
75#if __has_attribute (format)
76#define __format(...) __attribute__ ((format (__VA_ARGS__)))
77#else
78#define __format(...)
79#endif
80#else
81#define __format(...)
82#endif
83
73#endif 84#endif
diff --git a/include/stdio.h b/include/stdio.h
index 67738ed..52032ae 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -121,6 +121,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 121 * 3) not implementing these under clang, which is what we do for now
122 */ 122 */
123 123
124__format(printf, 3, 4)
124_FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, 125_FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n,
125 const char *__f, ...) 126 const char *__f, ...)
126{ 127{
@@ -131,6 +132,7 @@ _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n,
131 return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack()); 132 return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
132} 133}
133 134
135__format(printf, 2, 3)
134_FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) 136_FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...)
135{ 137{
136 size_t __b = __bos(__s, 0); 138 size_t __b = __bos(__s, 0);