msvcrt: Don't read past end of string in _strnicoll/_wcsnicoll.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2018-08-17 18:51:29 +02:00 committed by Alexandre Julliard
parent 9aa7a42a9f
commit eb37e2e482
2 changed files with 4 additions and 2 deletions

View File

@ -694,7 +694,8 @@ int CDECL MSVCRT__strnicoll_l( const char* str1, const char* str2, MSVCRT_size_t
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
return strncasecmp(str1, str2, count);
return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
str1, count, str2, count)-CSTR_EQUAL;
str1, MSVCRT_strnlen(str1, count),
str2, MSVCRT_strnlen(str2, count))-CSTR_EQUAL;
}
/*********************************************************************

View File

@ -151,7 +151,8 @@ int CDECL MSVCRT__wcsnicoll_l(const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t*
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
return strncmpiW(str1, str2, count);
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
str1, count, str2, count)-CSTR_EQUAL;
str1, MSVCRT_wcsnlen(str1, count),
str2, MSVCRT_wcsnlen(str2, count))-CSTR_EQUAL;
}
/*********************************************************************