diff options
| author | q66 | 2023-12-15 23:09:31 +0100 |
|---|---|---|
| committer | Julien Voisin | 2023-12-15 23:32:37 +0100 |
| commit | ca2df4878c2539c6a66553df182758a01ebcdcb8 (patch) | |
| tree | 239e5b86a4e8577c1819413d2a380aa93c69a85a /include/stdlib.h | |
| parent | 8d090c8a1a86408fa8b54029b97fccd17f9d35d5 (diff) | |
Move wctomb to stdlib.h and disable it for now
Diffstat (limited to 'include/stdlib.h')
| -rw-r--r-- | include/stdlib.h | 18 |
1 files changed, 18 insertions, 0 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) |
