Commit a564a54e authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

hm, don't free the home dir and append the .netrc part properly

parent 92186dc3
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -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,14 +93,15 @@ int Curl_parsenetrc(char *host,
    if(!home) {
      return -1;
    }
  }

  if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) {
    if(NULL==pw)
      free(home);
    return -1;
  }

  sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
  }

  file = fopen(netrcbuffer, "r");
  if(file) {
@@ -164,6 +165,7 @@ int Curl_parsenetrc(char *host,
    fclose(file);
  }

  if(NULL==pw)
    free(home);

  return retcode;