From 9b5b6a2b1a97b4c49e17b781068f14520f4359fd Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 15 Mar 2014 09:57:41 +0100 Subject: [PATCH] ssh: prevent a logic error that could result in an infinite loop --- lib/ssh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ssh.c b/lib/ssh.c index 5895a10cb..ad6d3226e 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -2204,7 +2204,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT After nextstate is executed,the control should come back to SSH_SFTP_CLOSE to pass the correct result back */ - if(sshc->nextstate != SSH_NO_STATE) { + if(sshc->nextstate != SSH_NO_STATE && + sshc->nextstate != SSH_SFTP_CLOSE) { state(conn, sshc->nextstate); sshc->nextstate = SSH_SFTP_CLOSE; }