cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] Fix segfault if --libcurl output file cannot be created.

From: Paul Broadhead <paul.broadhead_at_gmail.com>
Date: Mon, 02 Feb 2015 19:43:27 +0000

The seg fault occurs because by the time the code dump function is called,
the config->current pointer is null as all the configurations have been
executed. I'm not sure which configuration should be use in multi-config
cases. Using last looked to be the most likely intended given the position
from which the code is called. You should of course fix the bug in what
ever way is best. I would be happy to test you fix. I'm using curl on Linux
by the way.
Thanks.
Paul

On Mon, 2 Feb 2015 19:18 Steve Holme <steve_holme_at_hotmail.com> wrote:

> On Mon, 2 Feb 2015, Paul Broadhead wrote:
>
> > If the outfile for the --libcurl option cannot be created, curl seg
> faults:
> >
> > curl http://www.google.com --libcurl test/c
> >
> > Please find a very simple patch attached.
>
> Thank you for your patch Paul - however, I would be interested to know why
> config->current causes a segfault and why changing it to config->last fixes
> it.
>
> I'm running under Windows but if I perform the following all is okay:
>
> curl http://www.google.com --libcurl d:\test
>
> Note: d:\ is my DVD drive so isn't writable but I also tried a folder that
> doesn't exist as well.
>
> Also note: That "last" will not be the current configuration in a
> multi-config operations when --next is used however I think warnf() only
> uses global config variables now so I will investigate changing that
> function.
>
> Kind Regards
>
> Steve
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-02