diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stdlib.h | 18 | ||||
| -rw-r--r-- | include/wchar.h | 15 |
2 files changed, 18 insertions, 15 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 6081170..4b47297 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
| @@ -59,6 +59,24 @@ _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, | |||
| 59 | return __orig_wcstombs(__s, __ws, __n); | 59 | return __orig_wcstombs(__s, __ws, __n); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | #if 0 | ||
| 63 | /* https://github.com/jvoisin/fortify-headers/issues/24 */ | ||
| 64 | #ifdef MB_CUR_MAX | ||
| 65 | #undef wctomb | ||
| 66 | #if __has_builtin(__builtin_wctomb) | ||
| 67 | __diagnose_as_builtin(__builtin_wctomb, 1, 2) | ||
| 68 | #endif | ||
| 69 | _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) | ||
| 70 | { | ||
| 71 | __fh_size_t __b = __bos(__s, 0); | ||
| 72 | |||
| 73 | if (__s && 16 > __b && MB_CUR_MAX > __b) | ||
| 74 | __builtin_trap(); | ||
| 75 | return __orig_wctomb(__s, __w); | ||
| 76 | } | ||
| 77 | #endif // MB_CUR_MAX | ||
| 78 | #endif | ||
| 79 | |||
| 62 | #undef qsort | 80 | #undef qsort |
| 63 | #if __has_builtin(__builtin_qsort) | 81 | #if __has_builtin(__builtin_qsort) |
| 64 | __diagnose_as_builtin(__builtin_qsort, 1, 2, 3, 4) | 82 | __diagnose_as_builtin(__builtin_qsort, 1, 2, 3, 4) |
diff --git a/include/wchar.h b/include/wchar.h index 7a2a192..e7e3db6 100644 --- a/include/wchar.h +++ b/include/wchar.h | |||
| @@ -224,21 +224,6 @@ _FORTIFY_FN(wcsrtombs) size_t wcsrtombs(char * _FORTIFY_POS0 __d, | |||
| 224 | return __r; | 224 | return __r; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | #ifdef MB_CUR_MAX | ||
| 228 | #undef wctomb | ||
| 229 | #if __has_builtin(__builtin_wctomb) | ||
| 230 | __diagnose_as_builtin(__builtin_wctomb, 1, 2) | ||
| 231 | #endif | ||
| 232 | _FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) | ||
| 233 | { | ||
| 234 | __fh_size_t __b = __bos(__s, 0); | ||
| 235 | |||
| 236 | if (__s && 16 > __b && MB_CUR_MAX > __b) | ||
| 237 | __builtin_trap(); | ||
| 238 | return __orig_wctomb(__s, __w); | ||
| 239 | } | ||
| 240 | #endif // MB_CUR_MAX | ||
| 241 | |||
| 242 | #if __has_builtin(__builtin_wmemcpy) | 227 | #if __has_builtin(__builtin_wmemcpy) |
| 243 | __diagnose_as_builtin(__builtin_wmemcpy, 1, 2, 3) | 228 | __diagnose_as_builtin(__builtin_wmemcpy, 1, 2, 3) |
| 244 | #endif | 229 | #endif |
