cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: exception in version 7.10.2

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 22 Nov 2002 17:55:32 +0100 (MET)

On Fri, 22 Nov 2002, Juan Ignacio Hervás wrote:

> I was working with version 7.10 and today I have downloaded the new version
> curl-7.10.2.zip. I have compiled the new library (Win32 and Visual C++ 6.0)
> and when I run my application I get the known exception "0xC0000005: Access
> Violation"in url.c (line 1639).

Oops. Thanks for your detailed report and analysis!

> So, is there a problem in my code? is possible to have a NULL pointer in
> this variable or this means that something is wrong? If I comment the line
> 1639 and modify 1644 (hostaddr?hostaddr->h_name:""), everything is working
> fine (at least it think so).

I think the correct fix would be like this:

diff -u -r1.245 url.c
--- url.c 20 Nov 2002 19:11:23 -0000 1.245
+++ url.c 22 Nov 2002 16:54:45 -0000
@@ -1643,7 +1643,7 @@
   }
 #else
   {
- Curl_addrinfo *hostaddr=dns->addr;
+ Curl_addrinfo *hostaddr=dns?dns->addr:NULL;
     struct in_addr in;
     (void) memcpy(&in.s_addr, &conn->serv_addr.sin_addr, sizeof (in.s_addr));
     infof(data, "Connected to %s (%s) port %d\n",

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-22