Module: wine Branch: master Commit: c2962b22838de4594b4a72212eeeb0afbbbba35a URL: https://gitlab.winehq.org/wine/wine/-/commit/c2962b22838de4594b4a72212eeeb0a...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Feb 15 14:25:35 2023 +0300
crypt32: Avoid truncating unicode chars.
So that strings containing Cyrillic Capital Letter ER (0x420) won't be quoted when not needed.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru
---
dlls/crypt32/str.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/crypt32/str.c b/dlls/crypt32/str.c index 855e5a1c123..3426889b2dd 100644 --- a/dlls/crypt32/str.c +++ b/dlls/crypt32/str.c @@ -139,6 +139,11 @@ static inline BOOL is_quotable_char(WCHAR c) } }
+static inline BOOL is_spaceW(WCHAR c) +{ + return c <= 0x7f && isspace((char)c); +} + static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz) { @@ -195,9 +200,9 @@ static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, case CERT_RDN_BMP_STRING: case CERT_RDN_UTF8_STRING: strLen = len = pValue->cbData / sizeof(WCHAR); - if (pValue->cbData && isspace(pValue->pbData[0])) + if (strLen && is_spaceW(((LPCWSTR)pValue->pbData)[0])) needsQuotes = TRUE; - if (pValue->cbData && isspace(pValue->pbData[strLen - 1])) + if (strLen && _spaceW(((LPCWSTR)pValue->pbData)[strLen - 1])) needsQuotes = TRUE; for (i = 0; i < strLen; i++) {