From ae9c385e13cff233527b55090dc8ae55de6664ae Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 15 Jul 2020 14:05:36 +0200 Subject: [PATCH] msvcrt: Don't use strstrW in wcsstr. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcrt/wcs.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 59ff24e1967..ff066fb5c56 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -2652,7 +2652,19 @@ int CDECL MSVCRT_wcslen(const MSVCRT_wchar_t *str) */ MSVCRT_wchar_t* CDECL MSVCRT_wcsstr(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *sub) { - return strstrW(str, sub); + while(*str) + { + const MSVCRT_wchar_t *p1 = str, *p2 = sub; + while(*p1 && *p2 && *p1 == *p2) + { + p1++; + p2++; + } + if(!*p2) + return (MSVCRT_wchar_t*)str; + str++; + } + return NULL; } /*********************************************************************