]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4978: eCAP crash after using MyHost().newRequest() (#449)
authorVadim Salavatov <xremmargorpx@gmail.com>
Tue, 6 Aug 2019 23:11:36 +0000 (23:11 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 7 Aug 2019 09:11:27 +0000 (09:11 +0000)
Since commit 8babada, Squid was using a c_str() result after its
std::string toString() source went out of scope.

src/adaptation/ecap/MessageRep.cc

index 16cfd797823a1c33d5c162b8bf17021e00a48bdf..6fc9aa2ed10c9beebca0cbe5fb5d5ed6ef916c8b 100644 (file)
@@ -204,8 +204,7 @@ Adaptation::Ecap::RequestLineRep::uri(const Area &aUri)
 {
     // TODO: if method is not set, AnyP::Uri::parse will assume it is not connect;
     // Can we change AnyP::Uri::parse API to remove the method parameter?
-    const char *buf = aUri.toString().c_str();
-    const bool ok = theMessage.url.parse(theMessage.method, buf);
+    const auto ok = theMessage.url.parse(theMessage.method, aUri.toString().c_str());
     Must(ok);
 }