msvcrt: Handle null mbstr parameter in mbstowcs.
This commit is contained in:
parent
ec8e5c610b
commit
544d179434
|
@ -2127,6 +2127,11 @@ MSVCRT_size_t CDECL MSVCRT__mbstowcs_l(MSVCRT_wchar_t *wcstr, const char *mbstr,
|
||||||
MSVCRT_pthreadlocinfo locinfo;
|
MSVCRT_pthreadlocinfo locinfo;
|
||||||
MSVCRT_size_t i, size;
|
MSVCRT_size_t i, size;
|
||||||
|
|
||||||
|
if(!mbstr) {
|
||||||
|
*MSVCRT__errno() = MSVCRT_EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if(!locale)
|
if(!locale)
|
||||||
locinfo = get_locinfo();
|
locinfo = get_locinfo();
|
||||||
else
|
else
|
||||||
|
|
|
@ -1635,6 +1635,11 @@ static void test_mbstowcs(void)
|
||||||
wOut[4] = '!'; wOut[5] = '\0';
|
wOut[4] = '!'; wOut[5] = '\0';
|
||||||
mOut[4] = '!'; mOut[5] = '\0';
|
mOut[4] = '!'; mOut[5] = '\0';
|
||||||
|
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
ret = mbstowcs(wOut, NULL, 4);
|
||||||
|
ok(ret == -1, "mbstowcs did not return -1\n");
|
||||||
|
ok(errno == EINVAL, "errno = %d\n", errno);
|
||||||
|
|
||||||
ret = mbstowcs(NULL, mSimple, 0);
|
ret = mbstowcs(NULL, mSimple, 0);
|
||||||
ok(ret == 4, "mbstowcs did not return 4\n");
|
ok(ret == 4, "mbstowcs did not return 4\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue