diff --git a/src/system/libroot/posix/locale/wctype.cpp b/src/system/libroot/posix/locale/wctype.cpp index d2d225647c..8534aaa28f 100644 --- a/src/system/libroot/posix/locale/wctype.cpp +++ b/src/system/libroot/posix/locale/wctype.cpp @@ -123,8 +123,11 @@ iswxdigit(wint_t wc) wint_t towlower(wint_t wc) { - if (gLocaleBackend == NULL) + if (gLocaleBackend == NULL) { + if (wc < 0 || wc > 127) + return wc; return tolower(wc); + } wint_t result = wc; gLocaleBackend->ToWCTrans(wc, _ISlower, result); @@ -136,8 +139,11 @@ towlower(wint_t wc) wint_t towupper(wint_t wc) { - if (gLocaleBackend == NULL) + if (gLocaleBackend == NULL) { + if (wc < 0 || wc > 127) + return wc; return toupper(wc); + } wint_t result = wc; gLocaleBackend->ToWCTrans(wc, _ISupper, result);