|
@@ -71,10 +71,14 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
|
|
/* It is referenced to the home directory, so strip the
|
|
|
leading '/' */
|
|
|
memcpy(real_path, homedir, homelen);
|
|
|
- real_path[homelen] = '/';
|
|
|
- real_path[homelen + 1] = '\0';
|
|
|
+ /* Only add a trailing '/' if homedir does not end with one */
|
|
|
+ if(homelen == 0 || real_path[homelen - 1] != '/') {
|
|
|
+ real_path[homelen] = '/';
|
|
|
+ homelen++;
|
|
|
+ real_path[homelen] = '\0';
|
|
|
+ }
|
|
|
if(working_path_len > 3) {
|
|
|
- memcpy(real_path + homelen + 1, working_path + 3,
|
|
|
+ memcpy(real_path + homelen, working_path + 3,
|
|
|
1 + working_path_len -3);
|
|
|
}
|
|
|
}
|