mirror of
https://github.com/curl/curl.git
synced 2026-04-14 18:11:40 +03:00
libssh: path length precaution
Make sure the string is non-zero before indexing it -1. Right now, the path is always non-zero length so this is more for (future) safety reasons. Closes #21193
This commit is contained in:
parent
38b626e790
commit
d888a53e14
1 changed files with 3 additions and 1 deletions
|
|
@ -2029,7 +2029,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data,
|
|||
if(data->state.upload)
|
||||
myssh_to(data, sshc, SSH_SFTP_UPLOAD_INIT);
|
||||
else if(sshp) {
|
||||
if(sshp->path[strlen(sshp->path) - 1] == '/')
|
||||
size_t path_len = strlen(sshp->path);
|
||||
|
||||
if(path_len && sshp->path[path_len - 1] == '/')
|
||||
myssh_to(data, sshc, SSH_SFTP_READDIR_INIT);
|
||||
else
|
||||
myssh_to(data, sshc, SSH_SFTP_DOWNLOAD_INIT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue