cURL / Mailing Lists / curl-library / Single Mail


slist_append segfault

From: Rob Ward <>
Date: Wed, 27 Jun 2012 21:43:20 +0100

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.

I have also attached a patch that updates the man page in the event the
first patch is included and a mini c app that replicates the segfault on
current curl builds and demonstrates the fix functions correctly on



Rob Ward

List admin:

Received on 2012-06-27