Author: janderwald Date: Wed May 21 10:33:38 2008 New Revision: 33622
URL: http://svn.reactos.org/svn/reactos?rev=33622&view=rev Log: - check input parameters in LoadString[A|W] - fixes a winetest issue - patch by Kamil Hornicek (Pigglesworth)
Modified: trunk/reactos/dll/win32/user32/misc/resources.c
Modified: trunk/reactos/dll/win32/user32/misc/resources.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/resou... ============================================================================== --- trunk/reactos/dll/win32/user32/misc/resources.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/resources.c [iso-8859-1] Wed May 21 10:33:38 2008 @@ -116,11 +116,13 @@ INT retSize;
/* parameter validation */ - if - ( - (nBufferMax < 1) || - (IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0]))) - ) + + if(nBufferMax < 1) + { + return -1; + } + + if(IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0]))) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -196,7 +198,8 @@ /* parameter validation */ if ( - (nBufferMax < 1) || + (nBufferMax < 0) || + (lpBuffer == NULL) || ((nBufferMax > 0) && IsBadWritePtr(lpBuffer, nBufferMax * sizeof(lpBuffer[0]))) || /* undocumented: If nBufferMax is 0, LoadStringW will copy a pointer to the in-memory image of the string to the specified buffer and return the length