fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit c08370434fe1c1cdc0963cf2317583676bb1799b
parent ae6576eada328e1b7d0ba42b35e157c0aaa38299
Author: jvoisin <julien.voisin@dustri.org>
Date:   Fri, 31 Oct 2025 21:08:47 +0100

Remove wctomb

It's unfortunately valid to pass a buffer smaller than MB_CUR_MAX to wctomb, so
let's not trap on this. Moreover, it's supposed to be implemented in stdlib.h
and not wchar.h anyway.

Diffstat:
Minclude/wchar.h | 10----------
1 file changed, 0 insertions(+), 10 deletions(-)

diff --git a/include/wchar.h b/include/wchar.h @@ -51,7 +51,6 @@ extern "C" { #undef wcsncpy #undef wcsrtombs #undef wcstombs -#undef wctomb #undef wmemcpy #undef wmemmove #undef wmemset @@ -228,15 +227,6 @@ _FORTIFY_FN(wcstombs) size_t wcstombs(char * _FORTIFY_POS0 __s, return __orig_wcstombs(__s, __ws, __n); } -_FORTIFY_FN(wctomb) int wctomb(char * _FORTIFY_POS0 __s, wchar_t __w) -{ - size_t __b = __bos(__s, 0); - - if (__s && MB_LEN_MAX > __b && MB_CUR_MAX > __b) - __builtin_trap(); - return __orig_wctomb(__s, __w); -} - _FORTIFY_FN(wmemcpy) wchar_t *wmemcpy(wchar_t * _FORTIFY_POS0 __d, const wchar_t *__s, size_t __n) {