summaryrefslogtreecommitdiff
path: root/include/stdio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stdio.h')
-rw-r--r--include/stdio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h
index 582be4f..25e7ad2 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -145,11 +145,15 @@ __diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4)
145_FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, 145_FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
146 const char *__f, __builtin_va_list __v) 146 const char *__f, __builtin_va_list __v)
147{ 147{
148#if __has_builtin(__builtin___vsnprintf_chk) && USE_NATIVE_CHK
149 return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v,);
150#else
148 size_t __b = __bos(__s, 0); 151 size_t __b = __bos(__s, 0);
149 152
150 if (__n > __b) 153 if (__n > __b)
151 __builtin_trap(); 154 __builtin_trap();
152 return __orig_vsnprintf(__s, __n, __f, __v); 155 return __orig_vsnprintf(__s, __n, __f, __v);
156#endif
153} 157}
154 158
155__format(printf, 2, 0) 159__format(printf, 2, 0)
@@ -161,6 +165,9 @@ __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3)
161_FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, 165_FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f,
162 __builtin_va_list __v) 166 __builtin_va_list __v)
163{ 167{
168#if __has_builtin(__builtin___vsnprintf_chk) && USE_NATIVE_CHK
169 return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v,);
170#else
164 size_t __b = __bos(__s, 0); 171 size_t __b = __bos(__s, 0);
165 int __r; 172 int __r;
166 173
@@ -172,8 +179,10 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f,
172 __r = __orig_vsprintf(__s, __f, __v); 179 __r = __orig_vsprintf(__s, __f, __v);
173 } 180 }
174 return __r; 181 return __r;
182#endif
175} 183}
176 184
185
177#if __has_builtin(__builtin_va_arg_pack) 186#if __has_builtin(__builtin_va_arg_pack)
178 187
179/* clang is missing __builtin_va_arg_pack, so we cannot use these impls 188/* clang is missing __builtin_va_arg_pack, so we cannot use these impls