mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 00:58:48 -05:00
scp: fix directory name length used in memcpy
Fix read off end of array due to bad pointer math in getworkingpath for SCP home directory case. Closes #4258
This commit is contained in:
parent
65fda739ee
commit
25f9621935
@ -55,7 +55,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
|
||||
}
|
||||
if((working_path_len > 3) && (!memcmp(working_path, "/~/", 3)))
|
||||
/* It is referenced to the home directory, so strip the leading '/~/' */
|
||||
memcpy(real_path, working_path + 3, 4 + working_path_len-3);
|
||||
memcpy(real_path, working_path + 3, working_path_len - 2);
|
||||
else
|
||||
memcpy(real_path, working_path, 1 + working_path_len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user