if(str_w_len > 0) {
str_w = CURLX_MALLOC(str_w_len * sizeof(wchar_t));
if(str_w) {
- if(MultiByteToWideChar(CP_UTF8, 0,
+ if(MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
str_utf8, -1, str_w, str_w_len) == 0) {
CURLX_FREE(str_w);
return NULL;
if(str_w_len > 0) {
str_w = curlx_malloc(str_w_len * sizeof(wchar_t));
if(str_w) {
- if(MultiByteToWideChar(CP_UTF8, 0, str_utf8, -1, str_w,
- str_w_len) == 0) {
+ if(MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
+ str_utf8, -1, str_w, str_w_len) == 0) {
curlx_free(str_w);
return NULL;
}
/* Returned in_w_len includes the null-terminator, which then gets
preserved across the calls that follow, ending up terminating
the buffer returned to the caller. */
- in_w_len = MultiByteToWideChar(CP_UTF8, 0, in, -1, in_w, IDN_MAX_LENGTH);
+ in_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
+ in, -1, in_w, IDN_MAX_LENGTH);
if(in_w_len) {
wchar_t punycode[IDN_MAX_LENGTH];
int chars = IdnToAscii(0, in_w, in_w_len, punycode, IDN_MAX_LENGTH);
/* Returned in_w_len includes the null-terminator, which then gets
preserved across the calls that follow, ending up terminating
the buffer returned to the caller. */
- in_w_len = MultiByteToWideChar(CP_UTF8, 0, in, -1, in_w, IDN_MAX_LENGTH);
+ in_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
+ in, -1, in_w, IDN_MAX_LENGTH);
if(in_w_len) {
WCHAR idn[IDN_MAX_LENGTH]; /* stores a UTF-16 string */
int chars = IdnToUnicode(0, in_w, in_w_len, idn, IDN_MAX_LENGTH);
if(pszPassword) {
int str_w_len = 0;
if(pwd_len > 0)
- str_w_len = MultiByteToWideChar(CP_UTF8,
- MB_ERR_INVALID_CHARS,
- sslc->key_passwd,
- (int)pwd_len,
+ str_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
+ sslc->key_passwd, (int)pwd_len,
pszPassword, (int)(pwd_len + 1));
if((str_w_len >= 0) && (str_w_len <= (int)pwd_len))