diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2001-03-14 16:12:47 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2001-03-14 16:12:47 +0000 | 
| commit | a564a54e215db69a74a02a37c3db88ae40f5a487 (patch) | |
| tree | d64e56ac5ef6c3aaa43877898c0a040b0b2e148a /lib | |
| parent | 92186dc3d3344353246e2e12f6e9730bd6178dd5 (diff) | |
hm, don't free the home dir and append the .netrc part properly
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/netrc.c | 16 | 
1 files changed, 9 insertions, 7 deletions
| diff --git a/lib/netrc.c b/lib/netrc.c index f8f16058c..2911af53e 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -83,7 +83,7 @@ int Curl_parsenetrc(char *host,    struct passwd *pw;    pw= getpwuid(geteuid());    if (pw) -    strncat(netrcbuffer, pw->pw_dir, 255); +    home = pw->pw_dir;  #else    void *pw=NULL;  #endif @@ -93,15 +93,16 @@ int Curl_parsenetrc(char *host,      if(!home) {        return -1;      } +  } -    if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) { +  if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) { +    if(NULL==pw)        free(home); -      return -1; -    } - -    sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC); +    return -1;    } +  sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC); +    file = fopen(netrcbuffer, "r");    if(file) {      char *tok; @@ -164,7 +165,8 @@ int Curl_parsenetrc(char *host,      fclose(file);    } -  free(home); +  if(NULL==pw) +    free(home);    return retcode;  } | 
