cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl crashes on comparing null pointer

From: Shmulik Regev <shmulbox_at_gmail.com>
Date: Wed, 24 Jan 2007 13:13:04 +0200

Hi,

libcurl (7.16.0) crashes on null pointer access in http.c:1720 . The data->
state.first_host is null. While this can presumably be handled by
curl_strequal (though it may break its semantics), I've fixed it directly in
http.c, the patch is below.

Cheers,
Shmulik Regev

Index: C:/dev/repos/trunk/rapport/thirdparty/curl-7.16.0/lib/http.c
===================================================================
--- C:/dev/repos/trunk/rapport/thirdparty/curl-7.16.0/lib/http.c
 (revision 114)
+++ C:/dev/repos/trunk/rapport/thirdparty/curl-7.16.0/lib/http.c (working
copy)
@@ -1717,7 +1717,7 @@

   ptr = checkheaders(data, "Host:");
   if(ptr && (!data->state.this_is_a_follow ||
- curl_strequal(data->state.first_host, conn->host.name))) {
+ (data->state.first_host && curl_strequal(data->
state.first_host, conn->host.name))) ) {
 #if !defined(CURL_DISABLE_COOKIES)
     /* If we have a given custom Host: header, we extract the host name in
        order to possibly use it for cookie reasons later on. We only allow
the
Received on 2007-01-24