wininet: Don't use INTERNET_MAX_* macros in parse_proxy_url.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
72f5c3f2e7
commit
e0c7741d22
|
@ -521,41 +521,32 @@ static void free_global_proxy( void )
|
||||||
|
|
||||||
static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url )
|
static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url )
|
||||||
{
|
{
|
||||||
static const WCHAR fmt[] = {'%','s',':','%','u',0};
|
static const WCHAR fmt[] = {'%','.','*','s',':','%','u',0};
|
||||||
WCHAR hostname[INTERNET_MAX_HOST_NAME_LENGTH];
|
URL_COMPONENTSW uc = {sizeof(uc)};
|
||||||
WCHAR username[INTERNET_MAX_USER_NAME_LENGTH];
|
|
||||||
WCHAR password[INTERNET_MAX_PASSWORD_LENGTH];
|
|
||||||
URL_COMPONENTSW uc;
|
|
||||||
|
|
||||||
hostname[0] = username[0] = password[0] = 0;
|
uc.dwHostNameLength = 1;
|
||||||
memset( &uc, 0, sizeof(uc) );
|
uc.dwUserNameLength = 1;
|
||||||
uc.dwStructSize = sizeof(uc);
|
uc.dwPasswordLength = 1;
|
||||||
uc.lpszHostName = hostname;
|
|
||||||
uc.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
|
|
||||||
uc.lpszUserName = username;
|
|
||||||
uc.dwUserNameLength = INTERNET_MAX_USER_NAME_LENGTH;
|
|
||||||
uc.lpszPassword = password;
|
|
||||||
uc.dwPasswordLength = INTERNET_MAX_PASSWORD_LENGTH;
|
|
||||||
|
|
||||||
if (!InternetCrackUrlW( url, 0, 0, &uc )) return FALSE;
|
if (!InternetCrackUrlW( url, 0, 0, &uc )) return FALSE;
|
||||||
if (!hostname[0])
|
if (!uc.dwHostNameLength)
|
||||||
{
|
{
|
||||||
if (!(info->proxy = heap_strdupW( url ))) return FALSE;
|
if (!(info->proxy = heap_strdupW( url ))) return FALSE;
|
||||||
info->proxyUsername = NULL;
|
info->proxyUsername = NULL;
|
||||||
info->proxyPassword = NULL;
|
info->proxyPassword = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (!(info->proxy = heap_alloc( (strlenW(hostname) + 12) * sizeof(WCHAR) ))) return FALSE;
|
if (!(info->proxy = heap_alloc( (uc.dwHostNameLength + 12) * sizeof(WCHAR) ))) return FALSE;
|
||||||
sprintfW( info->proxy, fmt, hostname, uc.nPort );
|
sprintfW( info->proxy, fmt, uc.dwHostNameLength, uc.lpszHostName, uc.nPort );
|
||||||
|
|
||||||
if (!username[0]) info->proxyUsername = NULL;
|
if (!uc.dwUserNameLength) info->proxyUsername = NULL;
|
||||||
else if (!(info->proxyUsername = heap_strdupW( username )))
|
else if (!(info->proxyUsername = heap_strndupW( uc.lpszUserName, uc.dwUserNameLength )))
|
||||||
{
|
{
|
||||||
heap_free( info->proxy );
|
heap_free( info->proxy );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!password[0]) info->proxyPassword = NULL;
|
if (!uc.dwPasswordLength) info->proxyPassword = NULL;
|
||||||
else if (!(info->proxyPassword = heap_strdupW( password )))
|
else if (!(info->proxyPassword = heap_strndupW( uc.lpszPassword, uc.dwPasswordLength )))
|
||||||
{
|
{
|
||||||
heap_free( info->proxyUsername );
|
heap_free( info->proxyUsername );
|
||||||
heap_free( info->proxy );
|
heap_free( info->proxy );
|
||||||
|
|
Loading…
Reference in New Issue