From b78538deab593430829273bca23b9d76e4e5f77f Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 3 May 2018 15:52:04 +0000 Subject: [PATCH] Bug 4852: regression in deny_info %R macro (#193) SBuf::c_str() produces a temporary c-string which is not guaranteed to survive, and does not survive as long as required to print the deny_info URL. The HttpRequest::url path SBuf has a much longer lifetime, so use a const reference to it instead. This was added in 51b5dcf59c93ef76fefacfeae837b076a624596e along with many other identical uses which have since been removed by other refactorings. --- src/errorpage.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/errorpage.cc b/src/errorpage.cc index 0130629a54..fb4948b535 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -955,8 +955,8 @@ ErrorState::Convert(char token, bool building_deny_info_url, bool allowRecursion case 'R': if (building_deny_info_url) { if (request != NULL) { - SBuf tmp = request->url.path(); - p = tmp.c_str(); + const SBuf &tmp = request->url.path(); + mb.append(tmp.rawContent(), tmp.length()); no_urlescape = 1; } else p = "[no request]"; -- 2.47.2