cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] Curl_cookie_clearsess segfaults on new handle

From: Michael Wallner <mike_at_iworks.at>
Date: Tue, 13 Jan 2009 11:05:39 +0100

Hi,

attached is a patch which fixes a NULL pointer deref
when calling

curl_easy_setup(curl, CURLOPT_COOKIELIST, "SESS")

on a CURL handle with no cookies data.

Thanks,
Mike

Index: lib/cookie.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/cookie.c,v
retrieving revision 1.99
diff -u -r1.99 cookie.c
--- lib/cookie.c 3 Dec 2008 15:08:09 -0000 1.99
+++ lib/cookie.c 13 Jan 2009 10:01:00 -0000
@@ -878,7 +878,7 @@
 {
   struct Cookie *first, *curr, *next, *prev = NULL;
 
- if(!cookies->cookies)
+ if(!cookies || !cookies->cookies)
     return;
 
   first = curr = prev = cookies->cookies;
Received on 2009-01-13