From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/msvcrt/string.c | 6 +++--- dlls/ucrtbase/tests/string.c | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index d58a21406b1..c03a618f9bb 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -3313,7 +3313,7 @@ int __cdecl _strnicmp_l(const char *s1, const char *s2, pthreadlocinfo locinfo; int c1, c2;
- if(s1==NULL || s2==NULL) + if(!MSVCRT_CHECK_PMT(s1 && s2 && count <= 0x7fffffff)) return _NLSCMPERROR;
if(!count) @@ -3349,7 +3349,7 @@ int __cdecl _strnicmp_l(const char *s1, const char *s2, */ int __cdecl _stricmp_l(const char *s1, const char *s2, _locale_t locale) { - return _strnicmp_l(s1, s2, -1, locale); + return _strnicmp_l(s1, s2, 0x7fffffff, locale); }
/********************************************************************* @@ -3365,7 +3365,7 @@ int __cdecl _strnicmp(const char *s1, const char *s2, size_t count) */ int __cdecl _stricmp(const char *s1, const char *s2) { - return _strnicmp_l(s1, s2, -1, NULL); + return _strnicmp_l(s1, s2, 0x7fffffff, NULL); }
/********************************************************************* diff --git a/dlls/ucrtbase/tests/string.c b/dlls/ucrtbase/tests/string.c index 2c6a02da7ae..bdf9d03209e 100644 --- a/dlls/ucrtbase/tests/string.c +++ b/dlls/ucrtbase/tests/string.c @@ -480,12 +480,22 @@ static void test__strnicmp(void) static const char str2[] = "test"; int ret;
+ SET_EXPECT(invalid_parameter_handler); + errno = 0xdeadbeef; + ret = _strnicmp(str1, NULL, 2); + CHECK_CALLED(invalid_parameter_handler); + ok(ret == _NLSCMPERROR, "got %d.\n", ret); + ok(errno == EINVAL, "Unexpected errno %d.\n", errno); + SET_EXPECT(invalid_parameter_handler); errno = 0xdeadbeef; ret = _strnicmp(str1, str2, -1); - todo_wine CHECK_CALLED(invalid_parameter_handler); - todo_wine ok(ret == _NLSCMPERROR, "got %d.\n", ret); - todo_wine ok(errno == EINVAL, "Unexpected errno %d.\n", errno); + CHECK_CALLED(invalid_parameter_handler); + ok(ret == _NLSCMPERROR, "got %d.\n", ret); + ok(errno == EINVAL, "Unexpected errno %d.\n", errno); + + ret = _strnicmp(str1, str2, 0); + ok(!ret, "got %d.\n", ret);
ret = _strnicmp(str1, str2, 0x7fffffff); ok(!ret, "got %d.\n", ret);