cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: slist_append segfault

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Thu, 28 Jun 2012 10:53:58 +0200

On Wednesday, June 27, 2012 21:43:20 Rob Ward wrote:
> Hi All,
>
> I've attached a patch for potential inclusion into curl. The patch modifies
> how slist_append handles the situation where a NULL char* is passed in,
> currently this causes a segfault. While I agree people shouldn't be passing
> a NULL value in I have fixed that issue in the app I discovered this in so
> it can't happen I do think that modifying curl so it doesn't segfault would
> be an improvement.
>
> The way I have chosen to fix this in curl is to allow append to return the
> original list is the data to be added is NULL, this both prevents a
> segfault and also prevents data loss(and potential memory leak) that would
> be caused by returning NULL.
>
> Any comments on validity/changes welcome.

This can effectively hide a real bug in the application, making it difficult
to debug. Are you aware of any other implementation of slist that behaves
this way?

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-28