mirror of
https://github.com/curl/curl.git
synced 2026-04-20 12:01:13 +03:00
libssh2: error check and null-terminate in ssh_state_sftp_readdir_link()
- null-terminate the result to match the other getter `libssh2_sftp_symlink_ex()` call. - check negative result and bail out early. Reported-by: Joshua Rogers Closes #18598
This commit is contained in:
parent
cec6c1cd9c
commit
9f18cb6544
1 changed files with 6 additions and 0 deletions
|
|
@ -2405,6 +2405,12 @@ static CURLcode ssh_state_sftp_readdir_link(struct Curl_easy *data,
|
|||
|
||||
curlx_dyn_free(&sshp->readdir_link);
|
||||
|
||||
if(rc < 0)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* It seems that this string is not always null-terminated */
|
||||
sshp->readdir_filename[rc] = '\0';
|
||||
|
||||
/* append filename and extra output */
|
||||
result = curlx_dyn_addf(&sshp->readdir, " -> %s", sshp->readdir_filename);
|
||||
if(result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue