[KERNEL32]: Check for NULL pointer specified to lstrlenA/W and return null length, as specified in the MSDN doc and checked by the tests of r74118.

This should remove the unwanted 1st-chance exceptions caught when debugging Office 2010 installation, that calls from time to time lstrlen with NULL pointers.

svn path=/trunk/; revision=74119
This commit is contained in:
Hermès Bélusca-Maïto 2017-03-06 19:17:53 +00:00
parent c5dde308bf
commit f606ee89dd

View file

@ -27,7 +27,8 @@ lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
return 1; return 1;
Result = CompareStringA(GetThreadLocale(), 0, lpString1, -1, lpString2, -1); Result = CompareStringA(GetThreadLocale(), 0, lpString1, -1, lpString2, -1);
if (Result) Result -= 2; if (Result)
Result -= 2;
return Result; return Result;
} }
@ -56,6 +57,7 @@ lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
return Result; return Result;
} }
/* /*
* @implemented * @implemented
*/ */
@ -144,6 +146,9 @@ lstrlenA(LPCSTR lpString)
{ {
INT Ret = 0; INT Ret = 0;
if (lpString == NULL)
return 0;
_SEH2_TRY _SEH2_TRY
{ {
Ret = strlen(lpString); Ret = strlen(lpString);
@ -292,6 +297,9 @@ lstrlenW(LPCWSTR lpString)
{ {
INT Ret = 0; INT Ret = 0;
if (lpString == NULL)
return 0;
_SEH2_TRY _SEH2_TRY
{ {
Ret = wcslen(lpString); Ret = wcslen(lpString);