From: wessels <> Date: Fri, 2 Mar 2001 06:02:31 +0000 (+0000) Subject: Avoid NULL http->entry pointer in clientBuildReplyHeader(). X-Git-Tag: SQUID_3_0_PRE1~1581 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6fd26c1830dcc3c95af0c497c98eb45c50e8f0ac;p=thirdparty%2Fsquid.git Avoid NULL http->entry pointer in clientBuildReplyHeader(). --- diff --git a/src/client_side.cc b/src/client_side.cc index c32fd39353..9f03ee92b0 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.529 2001/02/23 20:59:50 hno Exp $ + * $Id: client_side.cc,v 1.530 2001/03/01 23:02:31 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -288,7 +288,7 @@ clientRedirectDone(void *data, char *result) assert(http->redirect_state == REDIRECT_PENDING); http->redirect_state = REDIRECT_DONE; if (result) { - http_status status = (http_status)atoi(result); + http_status status = (http_status) atoi(result); if (status == HTTP_MOVED_PERMANENTLY || status == HTTP_MOVED_TEMPORARILY) { char *t = result; if ((t = strchr(result, ':')) != NULL) { @@ -1280,10 +1280,13 @@ clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep) * the objects age, so a Age: 0 header does not add any useful * information to the reply in any case. */ - if (http->entry->timestamp > -1) - if (http->entry->timestamp < squid_curtime) - httpHeaderPutInt(hdr, HDR_AGE, - squid_curtime - http->entry->timestamp); + if (NULL == http->entry) + (void) 0; + else if (http->entry->timestamp < 0) + (void) 0; + else if (http->entry->timestamp > squid_curtime) + httpHeaderPutInt(hdr, HDR_AGE, + squid_curtime - http->entry->timestamp); } /* Handle authentication headers */ if (request->auth_user_request)