msvcrt: Return error in mbstowcs if conversion fails.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-06-14 11:57:07 +02:00 committed by Alexandre Julliard
parent 5310f9690f
commit 7efd0c2c79

View file

@ -2266,6 +2266,11 @@ MSVCRT_size_t CDECL MSVCRT__mbstowcs_l(MSVCRT_wchar_t *wcstr, const char *mbstr,
size = MultiByteToWideChar(locinfo->lc_codepage, 0,
mbstr, size, wcstr, count);
if(!size) {
if(count) wcstr[0] = '\0';
*MSVCRT__errno() = MSVCRT_EILSEQ;
return -1;
}
if(size<count && wcstr)
wcstr[size] = '\0';