]> granicus.if.org Git - curl/commitdiff
Fixed an infinite loop when given an invalid SFTP quote command.
authorDan Fandrich <dan@coneharvesters.com>
Tue, 18 Mar 2008 22:59:04 +0000 (22:59 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 18 Mar 2008 22:59:04 +0000 (22:59 +0000)
CHANGES
RELEASE-NOTES
lib/ssh.c
tests/data/DISABLED
tests/data/test626

diff --git a/CHANGES b/CHANGES
index adf5958b95f6d3e6d304ec57456e398b585074a8..dd0ed6fa453aaeb5e36d9940f78c29951d35626a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,7 +8,7 @@
 
 Daniel Fandrich (18 Mar 2008)
 - Added test 626 to reproduce an infinite loop when given an invalid
-  SFTP quote command reported by Vincent Le Normand, but left it disabled.
+  SFTP quote command reported by Vincent Le Normand, and fixed it.
 
 Michal Marek (18 Mar 2008)
 - Added curl_easy_getinfo typechecker.
index 64e13b64239c72af51c8c6a1440cb633897ab36a..281bd59eba2f27ca66ac99c5ce6252ec9692ba67 100644 (file)
@@ -46,6 +46,7 @@ This release includes the following bugfixes:
  o sharing DNS cache between easy handles running in multiple threads could
    lead to crash
  o SFTP upload with CURLOPT_FTP_CREATE_MISSING_DIRS on re-used connection
+ o SFTP infinite loop when given an invalid quote command
 
 This release includes the following known bugs:
 
index f8b0f7643e431e172d0490c626e189c748b5db2b..b238e9c3bc18f5fa27e200767e50123421835a03 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -956,14 +956,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
         break;
       }
 
-      if(sshc->quote_path1) {
-        Curl_safefree(sshc->quote_path1);
-        sshc->quote_path1 = NULL;
-      }
-      if(sshc->quote_path2) {
-        Curl_safefree(sshc->quote_path2);
-        sshc->quote_path2 = NULL;
-      }
+      failf(data, "Unknown SFTP command");
+      Curl_safefree(sshc->quote_path1);
+      sshc->quote_path1 = NULL;
+      Curl_safefree(sshc->quote_path2);
+      sshc->quote_path2 = NULL;
+      state(conn, SSH_SFTP_CLOSE);
+      sshc->actualcode = CURLE_QUOTE_ERROR;
+      break;
     }
   }
   if(!sshc->quote_item) {
index e596ddcc1b43eb357cc677f684af86ffc47b19a7..eb8bc31901e2881ac201774a921b4f3c7bd242c7 100644 (file)
@@ -4,4 +4,3 @@
 # per line.
 # Lines starting with '#' letters are treated as comments.
 617
-626
index 46360fb4ebd4808b4ac86606b781ccc10f7a1c35..475b6d7ddb54372c93c7373031c31ce5db1c1dd6 100644 (file)
@@ -32,9 +32,9 @@ Test file for rename test
 #
 # Verify data after the test has been "shot"
 <verify>
-<file name="log/file626-renamed.txt">
-Test file for rename test
-</file>
+<errorcode>
+21
+</errorcode>
 <valgrind>
 disable
 </valgrind>