------------------------------------------------------------ revno: 14083 revision-id: squid3@treenet.co.nz-20160916185004-ql4nhzwswotza6zw parent: squid3@treenet.co.nz-20160916115328-0fpefy6pbtfq40cd author: Eduard Bagdasaryan committer: Amos Jeffries branch nick: 3.5 timestamp: Sat 2016-09-17 06:50:04 +1200 message: Fix potential ICAP null pointer dereference after rev.14082 Adjusted Adaptation::Icap::ModXact::finalizeLogInfo(), fixing possible "Null pointer dereference". Detected by Coverity Scan. Issue 1372977 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20160916185004-ql4nhzwswotza6zw # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 900564075422fd0beeb1a82e5d4f1073b02bb326 # timestamp: 2016-09-16 18:50:59 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20160916115328-\ # 0fpefy6pbtfq40cd # # Begin patch === modified file 'src/adaptation/icap/ModXact.cc' --- src/adaptation/icap/ModXact.cc 2016-09-16 11:53:28 +0000 +++ src/adaptation/icap/ModXact.cc 2016-09-16 18:50:04 +0000 @@ -1261,7 +1261,7 @@ { HttpRequest *adapted_request_ = NULL; HttpReply *adapted_reply_ = NULL; - HttpRequest *virgin_request_ = (virgin.cause ? virgin.cause : dynamic_cast(virgin.header)); + HttpRequest *virgin_request_ = const_cast(&virginRequest()); if (!(adapted_request_ = dynamic_cast(adapted.header))) { // if the request was not adapted, use virgin request to simplify // the code further below @@ -1269,7 +1269,7 @@ adapted_reply_ = dynamic_cast(adapted.header); } - Adaptation::Icap::History::Pointer h = (virgin_request_ ? virgin_request_->icapHistory() : NULL); + Adaptation::Icap::History::Pointer h = virgin_request_->icapHistory(); Must(h != NULL); // ICAPXaction::maybeLog calls only if there is a log al.icp.opcode = ICP_INVALID; al.url = h->log_uri.termedBuf();