shlwapi: return NULL from StrStr if needle is longer than haystack
Mark Harmstone
hellas at burntcomma.com
Mon May 19 15:05:55 CDT 2014
Hi,
This is needed to fix a potential buffer overrun in real_length in
libs/wine/sortkey.c.
Thanks
---
diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
index b4b5b8a..a160021 100644
--- a/dlls/shlwapi/string.c
+++ b/dlls/shlwapi/string.c
@@ -526,6 +526,7 @@ static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr,
LPCSTR lpszSearch,
return NULL;
iLen = strlen(lpszSearch);
+ if (iLen > strlen(lpszStr)) return NULL;
while (*lpszStr)
{
@@ -677,6 +678,7 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR
lpszSearch)
return NULL;
iLen = strlenW(lpszSearch);
+ if (iLen > strlenW(lpszStr)) return NULL;
while (*lpszStr)
{
More information about the wine-patches
mailing list