Commit 74a6921b authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Armel Asselin fixed a crash in the FTP code when using SINGLECWD mode and

files in the root directory.
parent 490cccba
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -7,6 +7,9 @@
                                  Changelog
                                  Changelog


Daniel (19 August 2006)
Daniel (19 August 2006)
- Armel Asselin fixed a crash in the FTP code when using SINGLECWD mode and
  files in the root directory.

- Andrew Biggs pointed out a "Expect: 100-continue" flaw where libcurl didn't
- Andrew Biggs pointed out a "Expect: 100-continue" flaw where libcurl didn't
  send the whole request at once, even though the Expect: header was disabled
  send the whole request at once, even though the Expect: header was disabled
  by the application. An effect of this change is also that small (< 1024
  by the application. An effect of this change is also that small (< 1024
+2 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@ This release includes the following changes:


This release includes the following bugfixes:
This release includes the following bugfixes:


 o SINGLECWD mode and using files in the root dir
 o Expect: header disabling work better
 o "Expect: 100-continue" disable on second POST on re-used connection
 o "Expect: 100-continue" disable on second POST on re-used connection
 o src/config.h.in is fixed
 o src/config.h.in is fixed


+5 −4
Original line number Original line Diff line number Diff line
@@ -3804,19 +3804,20 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
  case FTPFILE_SINGLECWD:
  case FTPFILE_SINGLECWD:
    /* get the last slash */
    /* get the last slash */
    slash_pos=strrchr(cur_pos, '/');
    slash_pos=strrchr(cur_pos, '/');
    if(slash_pos) {
    if(slash_pos || !cur_pos || !*cur_pos) {
      ftp->dirdepth = 1; /* we consider it to be a single dir */
      ftp->dirdepth = 1; /* we consider it to be a single dir */
      ftp->dirs = (char **)calloc(1, sizeof(ftp->dirs[0]));
      ftp->dirs = (char **)calloc(1, sizeof(ftp->dirs[0]));
      if(!ftp->dirs)
      if(!ftp->dirs)
        return CURLE_OUT_OF_MEMORY;
        return CURLE_OUT_OF_MEMORY;


      ftp->dirs[0] = curl_easy_unescape(conn->data, cur_pos,
      ftp->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/",
                                        (int)(slash_pos-cur_pos), NULL);
                                        slash_pos?(int)(slash_pos-cur_pos):1,
                                        NULL);
      if(!ftp->dirs[0]) {
      if(!ftp->dirs[0]) {
        free(ftp->dirs);
        free(ftp->dirs);
        return CURLE_OUT_OF_MEMORY;
        return CURLE_OUT_OF_MEMORY;
      }
      }
      ftp->file = slash_pos+1;  /* the rest is the file name */
      ftp->file = slash_pos ? slash_pos+1 : cur_pos; /* rest is file name */
    }
    }
    else
    else
      ftp->file = cur_pos;  /* this is a file name only */
      ftp->file = cur_pos;  /* this is a file name only */