From b3dbdfa3066d1cde4d72579527e2004218d4ec0d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Jan 2001 09:01:32 +0000 Subject: Robert Weaver's fix --- lib/getenv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/getenv.c') diff --git a/lib/getenv.c b/lib/getenv.c index 0c23e76aa..941ee8535 100644 --- a/lib/getenv.c +++ b/lib/getenv.c @@ -41,12 +41,13 @@ char *GetEnv(char *variable) char env[MAX_PATH]; /* MAX_PATH is from windef.h */ char *temp = getenv(variable); env[0] = '\0'; - ExpandEnvironmentStrings(temp, env, sizeof(env)); + if (temp != NULL) + ExpandEnvironmentStrings(temp, env, sizeof(env)); #else /* no length control */ char *env = getenv(variable); #endif - return env?strdup(env):NULL; + return (env && env[0])?strdup(env):NULL; } char *curl_getenv(char *v) -- cgit v1.2.3