cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1561470 ] Crash in curl_multi_cleanup on upload to ftp errors

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 19 Sep 2006 06:22:29 -0700

Bugs item #1561470, was opened at 2006-09-19 06:22
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1561470&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Crash in curl_multi_cleanup on upload to ftp errors

Initial Comment:
danil at mtsnet.ru

Platform: Win2000, mingw-2.95.2
libcurl: libcurl-7.15.4 and libcurl-7.15.6-20060911
+ssl builds downloaded from the official site

This is the similar bug to the described in https://
sourceforge.net/tracker/index.php?func=detail&aid=
1560773&group_id=976&atid=100976 but it happens during
cleanup of the multi handle after unsuccesful ftp
upload:

In the example below I'm running guildFTPd localy:

* About to connect() to 127.0.0.1 port 21
* Expire at 888825 / 165000 (300000ms)
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 21
* Expire cleared
* Remembering we are in dir Upload/test
< 220-GuildFTPd FTP Server (c) 1997-2002
< 220-Version 0.999.13
< 220 Please enter your name:
* server did not report OK, got 220
* Connection #0 to host 127.0.0.1 left intact
^^^^^
1) First we see that libcurl misinterprets ftpd result
of the ftpd (I don't see it in the easy-mode nor in
the application i've hit originally this bug).
2) When trying to release multi handle after this (or
other errors) - libcurl crashes

#include <stdio.h>
#include <curl/curl.h>

const char* theData = "this is a test\n";
int hasNotBeenSent = 1;

int fRead(void *dataPtr, unsigned items, unsigned
size, void* whatever);

int main()
{
        CURLSH *curlShare;
        CURLM* multiHandle;
        CURL* easyHandle;
        CURLcode curlCode;
        int isMultiRunning;

        curl_global_init(CURL_GLOBAL_ALL );

        easyHandle = curl_easy_init();
        curl_easy_setopt( easyHandle, CURLOPT_VERBOSE,
1);
        curl_easy_setopt( easyHandle, CURLOPT_
READFUNCTION, fRead);
        curl_easy_setopt( easyHandle, CURLOPT_READDATA,
0);
        curl_easy_setopt( easyHandle, CURLOPT_URL, "ftp:/
/127.0.0.1/Upload/test");
        curl_easy_setopt( easyHandle, CURLOPT_
INFILESIZE, strlen(theData) );
        curl_easy_setopt( easyHandle, CURLOPT_UPLOAD, 1);

        multiHandle = curl_multi_init();
        curl_multi_add_handle( multiHandle, easyHandle
 );

        while(curlCode = curl_multi_perform(
multiHandle, &isMultiRunning ),
                                                curlCode == CURLM_
CALL_MULTI_PERFORM) ;;;

        curl_multi_remove_handle(multiHandle,
easyHandle);
        
        curl_multi_cleanup(multiHandle);
        printf("I can not get here\n");
        curl_easy_cleanup(easyHandle);
        curl_global_cleanup();

        return 0;
}

int fRead(void *dataPtr, unsigned items, unsigned
size, void* whatever)
{
        /* send the string one time */
        return hasNotBeenSent ?
                memcpy( dataPtr, theData, strlen(theData
)), hasNotBeenSent = 0, strlen (theData)
                : 0 ;
}

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1561470&group_id=976
Received on 2006-09-19

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET