cURL / Mailing Lists / curl-library / Single Mail


Access Violation!

From: Yanick Pelletier <>
Date: Thu, 1 Nov 2001 14:04:09 -0500

First of all i use libcurl v7.9.1
When i download some HTTP documents, some time an access violation occur in
the following function. It happen that the Curl_connecthost() function
return add with a value of 0. In this case the call to memcpy fail!
        static CURLcode ConnectPlease(struct connectdata *conn)
            CURLcode result;
            Curl_ipconnect *addr;
            * Connect to server/proxy
            result= Curl_connecthost(conn,
            if(CURLE_OK == result) {
                /* All is cool, then we store the current information from
the hostaddr
                   struct to the serv_addr, as it might be needed later. The
                   returned from the function above is crucial here. */
                memset((char *) &conn->serv_addr, '\0',
                memcpy((char *)&(conn->serv_addr.sin_addr),
                             (struct in_addr *)addr, sizeof(struct
                conn->serv_addr.sin_family = conn->hostaddr->h_addrtype;
                conn->serv_addr.sin_port = htons(conn->port);
            return result;

Does it is normal that Curl_connecthost() doesn't return an error in such
Maybe we can add a check case in the function to check such case like:
        if (addr == 0)
            return CURLE_COULDNT_CONNECT;
Received on 2001-11-01