]> sjero.net Git - wget/commitdiff
[svn] Handle invalid response to PWD gracefully.
authorhniksic <devnull@localhost>
Wed, 15 Jun 2005 20:11:50 +0000 (13:11 -0700)
committerhniksic <devnull@localhost>
Wed, 15 Jun 2005 20:11:50 +0000 (13:11 -0700)
src/ChangeLog
src/ftp-basic.c

index bc9df474a47522b0811cbb550010f96e143ed594..aff944577fb18e6d7c97dacd36ba1ea6ab2c3320 100644 (file)
@@ -1,3 +1,7 @@
+2005-06-15  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * ftp-basic.c (ftp_pwd): Handle malformed PWD response.
+
 2005-06-15  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * host.h (ip_address): Remove the trailing comma from the type
index 3c43b0c1a5f0bf0809f73728519c39b59a88bddf..0dee6d096072285af0a8f86c82a222ff7bdfdaf2 100644 (file)
@@ -1081,6 +1081,7 @@ ftp_pwd (int csock, char **pwd)
     return err;
   if (*respline == '5')
     {
+    err:
       xfree (respline);
       return FTPSRVERR;
     }
@@ -1089,6 +1090,10 @@ ftp_pwd (int csock, char **pwd)
      and everything following it. */
   strtok (respline, "\"");
   request = strtok (NULL, "\"");
+  if (!request)
+    /* Treat the malformed response as an error, which the caller has
+       to handle gracefully anyway.  */
+    goto err;
 
   /* Has the `pwd' been already allocated?  Free! */
   xfree_null (*pwd);