mirror of
https://github.com/curl/curl.git
synced 2026-08-03 11:00:29 +03:00
libssh2: fix error handling on quote errors
Previously it lacked the actual return. libssh.c uses the same function
name.
Verified by test 2007.
Reported-by: m777m0 on hackerone
Follow-up to 578706adde
Closes #20883
This commit is contained in:
parent
a221e2fbff
commit
53a3b2114a
4 changed files with 51 additions and 19 deletions
|
|
@ -1346,8 +1346,8 @@ static int myssh_in_SFTP_POSTQUOTE_INIT(struct Curl_easy *data,
|
|||
return SSH_NO_ERROR;
|
||||
}
|
||||
|
||||
static int return_quote_error(struct Curl_easy *data,
|
||||
struct ssh_conn *sshc)
|
||||
static int quote_error(struct Curl_easy *data,
|
||||
struct ssh_conn *sshc)
|
||||
{
|
||||
failf(data, "Suspicious data after the command line");
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
|
|
@ -1467,7 +1467,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data,
|
|||
return SSH_NO_ERROR;
|
||||
}
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
sshc->quote_attrs = NULL;
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_STAT);
|
||||
return SSH_NO_ERROR;
|
||||
|
|
@ -1490,13 +1490,13 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data,
|
|||
return SSH_NO_ERROR;
|
||||
}
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_SYMLINK);
|
||||
return SSH_NO_ERROR;
|
||||
}
|
||||
else if(!strncmp(cmd, "mkdir ", 6)) {
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
/* create directory */
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_MKDIR);
|
||||
return SSH_NO_ERROR;
|
||||
|
|
@ -1518,27 +1518,27 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data,
|
|||
return SSH_NO_ERROR;
|
||||
}
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_RENAME);
|
||||
return SSH_NO_ERROR;
|
||||
}
|
||||
else if(!strncmp(cmd, "rmdir ", 6)) {
|
||||
/* delete directory */
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_RMDIR);
|
||||
return SSH_NO_ERROR;
|
||||
}
|
||||
else if(!strncmp(cmd, "rm ", 3)) {
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_UNLINK);
|
||||
return SSH_NO_ERROR;
|
||||
}
|
||||
#ifdef HAS_STATVFS_SUPPORT
|
||||
else if(!strncmp(cmd, "statvfs ", 8)) {
|
||||
if(*cp)
|
||||
return return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_STATVFS);
|
||||
return SSH_NO_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -715,8 +715,8 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
|
||||
static CURLcode return_quote_error(struct Curl_easy *data,
|
||||
struct ssh_conn *sshc)
|
||||
static CURLcode quote_error(struct Curl_easy *data,
|
||||
struct ssh_conn *sshc)
|
||||
{
|
||||
failf(data, "Suspicious data after the command line");
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
|
|
@ -812,7 +812,7 @@ static CURLcode sftp_quote(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
|
||||
memset(&sshp->quote_attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_STAT);
|
||||
|
|
@ -831,13 +831,13 @@ static CURLcode sftp_quote(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_SYMLINK);
|
||||
return result;
|
||||
}
|
||||
else if(!strncmp(cmd, "mkdir ", 6)) {
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
/* create directory */
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_MKDIR);
|
||||
return result;
|
||||
|
|
@ -854,26 +854,26 @@ static CURLcode sftp_quote(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_RENAME);
|
||||
return result;
|
||||
}
|
||||
else if(!strncmp(cmd, "rmdir ", 6)) {
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
/* delete directory */
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_RMDIR);
|
||||
return result;
|
||||
}
|
||||
else if(!strncmp(cmd, "rm ", 3)) {
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_UNLINK);
|
||||
return result;
|
||||
}
|
||||
else if(!strncmp(cmd, "statvfs ", 8)) {
|
||||
if(*cp)
|
||||
return_quote_error(data, sshc);
|
||||
return quote_error(data, sshc);
|
||||
myssh_to(data, sshc, SSH_SFTP_QUOTE_STATVFS);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue