cURL / Mailing Lists / curl-library / Single Mail

curl-library

PATCH: Fix for crash in c-ares

From: Ravi Pratap <Ravi.Pratap_at_hillcrestlabs.com>
Date: Mon, 21 May 2007 14:38:17 -0400

Hello,

Here's a patch for a crash in c-ares on init, on a host that has no
network adapter, or has its cable unplugged. The crash really is related
to the status variable not being initialized properly in that code path.

Thanks,

Ravi.

Index: ares_init.c
===================================================================
RCS file: /cvsroot/curl/curl/ares/ares_init.c,v
retrieving revision 1.51
diff -u -r1.51 ares_init.c
--- ares_init.c 26 Feb 2007 04:33:19 -0000 1.51
+++ ares_init.c 21 May 2007 18:34:50 -0000
@@ -743,6 +743,12 @@
         free(servers);
       if (sortlist != NULL)
         free(sortlist);
+
+ /* Added to fix an exception on windows when the host doesn't
+ have a valid ip address, has its cable unplugged, or its
+ network adapter disabled */
+ status = ARES_ECONNREFUSED;
+
       return status;
     }
Received on 2007-05-21