Dynamic environment variable length of $https_proxy

This commit is contained in:
Christian Plattner 2016-12-12 17:16:12 +01:00
parent 50a3f55063
commit 3cc39b2dcd
1 changed files with 9 additions and 3 deletions

View File

@ -51,16 +51,22 @@ BOOL proxy_prepare(rdpSettings *settings, const char **lpPeerHostname, UINT16 *l
void proxy_read_environment(rdpSettings *settings, char *envname)
{
char env[256];
DWORD envlen;
char *env;
envlen = GetEnvironmentVariableA(envname, env, sizeof(env)-1);
envlen = GetEnvironmentVariableA(envname, NULL, 0);
if(!envlen)
return;
env[envlen] = '\0';
env = calloc(1, envlen + 1);
if (!env) {
WLog_ERR(TAG, "Not enough memory");
return;
}
envlen = GetEnvironmentVariableA(envname, env, envlen);
proxy_parse_uri(settings, env);
free(env);
}
BOOL proxy_parse_uri(rdpSettings *settings, const char *uri)