Commit 552b963e authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Dmitriy Sergeyev provided an example source code that crashed CVS libcurl

but that worked nicely in 7.15.5. I converted it into test case 532 and
fixed the problem.
parent e2b48366
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@

                                  Changelog

Daniel (4 October 2006)
- Dmitriy Sergeyev provided an example source code that crashed CVS libcurl
  but that worked nicely in 7.15.5. I converted it into test case 532 and
  fixed the problem.

Daniel (29 September 2006)
- Removed a few other no-longer present options from the header file.

+6 −0
Original line number Diff line number Diff line
@@ -655,6 +655,12 @@ void curl_easy_reset(CURL *curl)
{
  struct SessionHandle *data = (struct SessionHandle *)curl;

  Curl_safefree(data->reqdata.pathbuffer);
  data->reqdata.pathbuffer=NULL;

  Curl_safefree(data->reqdata.proto.generic);
  data->reqdata.proto.generic=NULL;

  /* zero out UserDefined data: */
  memset(&data->set, 0, sizeof(struct UserDefined));

+21 −3
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
{
  struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
  struct Curl_one_easy *easy;
  struct closure *cl;
  struct closure *prev=NULL;

  /* First, make some basic checks that the CURLM handle is a good handle */
  if(!GOOD_MULTI_HANDLE(multi))
@@ -368,7 +370,21 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
  if(!easy)
    return CURLM_OUT_OF_MEMORY;

  easy->numsocks=0;
  cl = multi->closure;
  while(cl) {
    struct closure *next = cl->next;
    if(cl->easy_handle == easy_handle) {
      /* remove this handle from the closure list */
      free(cl);
      if(prev)
        prev->next = next;
      else
        multi->closure = next;
      break; /* no need to continue since this handle can only be present once
                in the list */
    }
    cl = next;
  }

  /* set the easy handle */
  easy->easy_handle = easy_handle;
@@ -1796,8 +1812,10 @@ static bool multi_conn_using(struct Curl_multi *multi,
  return FALSE;
}

/* add the given data pointer to the list of 'closure handles' that are
   kept around only to be able to close some connections nicely */
/* Add the given data pointer to the list of 'closure handles' that are kept
   around only to be able to close some connections nicely - just make sure
   that this handle isn't already added, like for the cases when an easy
   handle is removed, added and removed again... */
static void add_closure(struct Curl_multi *multi,
                        struct SessionHandle *data)
{
+1 −1
Original line number Diff line number Diff line
@@ -35,4 +35,4 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
 test256 test257 test258 test259 test260 test261 test262 test263 test264   \
 test265 test266 test267 test268 test269 test270 test271 test272 test273   \
 test274 test275 test524 test525 test276 test277 test526 test527 test528   \
 test530 DISABLED test278 test279 test531 test280 test529
 test530 DISABLED test278 test279 test531 test280 test529 test532

tests/data/test532

0 → 100644
+61 −0
Original line number Diff line number Diff line
<info>
<keywords>
FTP
PASV
RETR
</keywords>
</info>
# Server-side
<reply>
<data>
file contents should appear once for each file
</data>
<datacheck>
file contents should appear once for each file
file contents should appear once for each file
file contents should appear once for each file
file contents should appear once for each file
</datacheck>
</reply>

# Client-side
<client>
<server>
ftp
</server>
<tool>
lib532
</tool>
 <name>
FTP RETR same file using reset handles between each transfer
 </name>
 <command>
ftp://%HOSTIP:%FTPPORT/path/532
</command>
</client>

# Verify data after the test has been "shot"
<verify>
<strip>
</strip>
<protocol>
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD path
EPSV
TYPE I
SIZE 532
RETR 532
EPSV
SIZE 532
RETR 532
EPSV
SIZE 532
RETR 532
EPSV
SIZE 532
RETR 532
QUIT
</protocol>
</verify>
Loading