From: Daniel Stenberg Date: Mon, 4 Dec 2017 08:00:34 +0000 (+0100) Subject: libssh2: remove dead code from SSH_SFTP_QUOTE X-Git-Tag: curl-7_58_0~109 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4401409468f590520dd5d0f0a55607eefa5ff4c1;p=thirdparty%2Fcurl.git libssh2: remove dead code from SSH_SFTP_QUOTE Figured out while reviewing code in the libssh backend. The pointer was checked for NULL after having been dereferenced, so we know it would always equal true or it would've crashed. Pointed-out-by: Nikos Mavrogiannopoulos Bug #2143 Closes #2148 --- diff --git a/lib/ssh.c b/lib/ssh.c index ef169ade7e..a4dd878bfc 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -1142,6 +1142,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* * Support some of the "FTP" commands + * + * 'sshc->quote_item' is already verified to be non-NULL before it + * switched to this state. */ char *cmd = sshc->quote_item->data; sshc->acceptfail = FALSE; @@ -1184,7 +1187,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) state(conn, SSH_SFTP_NEXT_QUOTE); break; } - if(cmd) { + { /* * the arguments following the command must be separated from the * command with a space so we can check for it unconditionally @@ -1314,9 +1317,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) break; } } - if(!sshc->quote_item) { - state(conn, SSH_SFTP_GETINFO); - } break; case SSH_SFTP_NEXT_QUOTE: