]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid segfaults on seriously malformed requests when ICAP logging is enabled.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 24 May 2013 23:40:50 +0000 (17:40 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 24 May 2013 23:40:50 +0000 (17:40 -0600)
src/format/Format.cc

index 3b7d34f88aa8621d3faccb65eb6d109ac3c103c5..604b463d6c19e51ab028a2a925f9699dc92d97fa 100644 (file)
@@ -629,7 +629,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             break;
 
         case LFT_ICAP_REQ_HEADER_ELEM:
-            if (al->request)
+            if (al->icap.request)
                 sb = al->icap.request->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator);
 
             out = sb.termedBuf();
@@ -1049,7 +1049,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
         case LFT_NOTE:
             if (fmt->data.string) {
 #if USE_ADAPTATION
-                Adaptation::History::Pointer ah = al->request->adaptHistory();
+                Adaptation::History::Pointer ah = al->request ? al->request->adaptHistory() : Adaptation::History::Pointer();
                 if (ah != NULL && ah->metaHeaders != NULL) {
                     if (const char *meta = ah->metaHeaders->find(fmt->data.string))
                         sb.append(meta);
@@ -1066,7 +1066,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
                 quote = 1;
             } else {
 #if USE_ADAPTATION
-                Adaptation::History::Pointer ah = al->request->adaptHistory();
+                Adaptation::History::Pointer ah = al->request ? al->request->adaptHistory() : Adaptation::History::Pointer();
                 if (ah != NULL && ah->metaHeaders != NULL && !ah->metaHeaders->empty())
                     sb.append(ah->metaHeaders->toString());
 #endif