]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sun, 8 Sep 2019 13:18:04 +0000 (01:18 +1200)
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 96af88c89b91e532ebb5bd3b38758e47c5787fba..039f9e1ef415f63903a0ac2dc458341127c65984 100644 (file)
@@ -200,8 +200,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);
 }