curl-library
Re: [PATCH] segfault when explicitly setting Host header and using CURLOPT_FOLLOWLOCATION
Date: Thu, 23 Apr 2009 23:52:18 +0200 (CEST)
On Wed, 22 Apr 2009, John Whaley wrote:
> We're running into a segfault when setting an explicit "Host:" header with
> CURLOPT_HTTPHEADER and CURLOPT_FOLLOWLOCATION is set to 1. The bug occurs
> when the server returns a redirect and curl is trying to decide whether to
> keep track of the original host name for cookies.
>
> The line of code that crashes is in Curl_http(). It is trying to
> string-compare data->state.first_host, unfortunately data->state.first_host
> is null at that point because this_is_a_follow is true at the time we called
> Curl_http_connect()
Thanks for your work and patch. I'm just not sure yet your suggested fix is
the best possible one:
... if this_is_a_follow is true, why isn't first_host already set from the
previous request that this follows from?
-- / daniel.haxx.seReceived on 2009-04-23