httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Edmundsson <ni...@acc.umu.se>
Subject Re: [PATCH] mod_cache: Don't follow NULL pointers.
Date Wed, 02 May 2007 12:21:30 GMT
On Wed, 2 May 2007, Niklas Edmundsson wrote:

> We encountered the following bug: httpd segfaulted due to a client emitting 
> "Cache-Control: max-age=216000, max-stale" which is a perfectly valid header.
>
> The segfault is caused by the fact that ap_cache_liststr() sets the value 
> pointer to NULL when there is no value, and this isn't checked at all in the 
> cases when a value pointer is passed.
>
> I think that this patch catches all those occurances.

Or so I thought.

It turned out that ap_cache_liststr() didn't set the value pointer to 
NULL in all cases where it should. Now it does.

> I'm not proud of the solution for max-stale without value, but it should do 
> the job...

It did, but it caused the freshness calculation to overflow so the end 
result was bollocks. I hard-coded 100 years for the max-stale without 
value case, not pretty but it works.

Updated patch attached.


/Nikke - not fond of fixing bugs with core-files as the only source of
          information :/
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  REJECTION: When your imaginary friends won't talk to you.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mime
View raw message