From: Vadim Salavatov Date: Tue, 6 Aug 2019 23:11:36 +0000 (+0000) Subject: Bug 4978: eCAP crash after using MyHost().newRequest() (#449) X-Git-Tag: SQUID_5_0_1~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71778e77daf5231e8b97195b831b4889aa1fa53e;p=thirdparty%2Fsquid.git Bug 4978: eCAP crash after using MyHost().newRequest() (#449) Since commit 8babada, Squid was using a c_str() result after its std::string toString() source went out of scope. --- diff --git a/src/adaptation/ecap/MessageRep.cc b/src/adaptation/ecap/MessageRep.cc index 16cfd79782..6fc9aa2ed1 100644 --- a/src/adaptation/ecap/MessageRep.cc +++ b/src/adaptation/ecap/MessageRep.cc @@ -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); }