1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

jsproxy: Don't ignore hostname and url length in InternetGetProxyInfo.

This commit is contained in:
Piotr Caban 2024-02-01 16:20:23 +01:00 committed by Alexandre Julliard
parent 1cbff7c8d6
commit 53faf7bda8
2 changed files with 13 additions and 8 deletions

View file

@ -576,13 +576,8 @@ BOOL WINAPI InternetGetProxyInfo( LPCSTR url, DWORD len_url, LPCSTR hostname, DW
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 (hostname && !(hostnameW = strdupAW( hostname, -1 ))) goto done;
if (!(urlW = strdupAW( url, len_url ))) goto done;
if (hostname && !(hostnameW = strdupAW( hostname, len_hostname ))) goto done;
TRACE( "%s\n", debugstr_w(global_script->text) );
ret = run_script( global_script->text, urlW, hostnameW, proxy, len_proxy );

View file

@ -104,7 +104,9 @@ static void test_InternetInitializeAutoProxyDll(void)
static void test_InternetGetProxyInfo(void)
{
const char url[] = "http://localhost";
char script[] = "function FindProxyForURL(url, host) { return \"DIRECT\"; }";
char script[] = "function FindProxyForURL(url, host) { "
"if (url.substring(0, 4) === 'test') return url + ' ' + host; "
"return \"DIRECT\"; }";
char *proxy, host[] = "localhost";
AUTO_PROXY_SCRIPT_BUFFER buf;
DWORD len, err;
@ -159,6 +161,14 @@ static void test_InternetGetProxyInfo(void)
ok( len == strlen("DIRECT") + 1, "got %lu\n", len );
GlobalFree( proxy );
len = 0;
proxy = NULL;
ret = pInternetGetProxyInfo( "testa", 4, host, 4, &proxy, &len);
ok( ret, "got %lu\n", GetLastError() );
ok( !strcmp( proxy, "test loca" ), "got \"%s\"\n", proxy );
ok( len == 10, "got %lu\n", len );
GlobalFree( proxy );
ret = pInternetDeInitializeAutoProxyDll( NULL, 0 );
ok( ret, "got %lu\n", GetLastError() );
}