jsproxy: Validate parameters in InternetInitializeAutoProxyDll and InternetGetProxyInfo.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6ea6b37096
commit
ea8b261abe
|
@ -188,8 +188,20 @@ BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll( DWORD version, LPSTR tmpfile
|
||||||
|
|
||||||
if (buffer && buffer->dwStructSize == sizeof(*buffer) && buffer->lpszScriptBuffer)
|
if (buffer && buffer->dwStructSize == sizeof(*buffer) && buffer->lpszScriptBuffer)
|
||||||
{
|
{
|
||||||
|
DWORD i, len = 0;
|
||||||
|
for (i = 0; i < buffer->dwScriptBufferSize; i++)
|
||||||
|
{
|
||||||
|
if (!buffer->lpszScriptBuffer[i]) break;
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
if (len == buffer->dwScriptBufferSize)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
LeaveCriticalSection( &cs_jsproxy );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
heap_free( global_script->text );
|
heap_free( global_script->text );
|
||||||
if( (global_script->text = strdupAW( buffer->lpszScriptBuffer, buffer->dwScriptBufferSize ))) ret = TRUE;
|
if ((global_script->text = strdupAW( buffer->lpszScriptBuffer, len ))) ret = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -627,7 +639,16 @@ BOOL WINAPI InternetGetProxyInfo( LPCSTR url, DWORD len_url, LPCSTR hostname, DW
|
||||||
|
|
||||||
EnterCriticalSection( &cs_jsproxy );
|
EnterCriticalSection( &cs_jsproxy );
|
||||||
|
|
||||||
if (!global_script->text) goto done;
|
if (!global_script->text)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_CAN_NOT_COMPLETE );
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (hostname && len_hostname < strlen( hostname ))
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
if (!(urlW = strdupAW( url, -1 ))) goto done;
|
if (!(urlW = strdupAW( url, -1 ))) goto done;
|
||||||
if (hostname && !(hostnameW = strdupAW( hostname, -1 ))) goto done;
|
if (hostname && !(hostnameW = strdupAW( hostname, -1 ))) goto done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue