From: Reinhard Sojka Date: Fri, 22 Feb 2013 11:13:25 +0000 (-0700) Subject: Bug 3790: cachemgr.cgi crash with authentication X-Git-Tag: SQUID_3_3_9~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9674d65f843dd2e1fb61b547f4c267623c03bf2;p=thirdparty%2Fsquid.git Bug 3790: cachemgr.cgi crash with authentication --- diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 83d532c370..9c51e6abba 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -1162,7 +1162,6 @@ make_auth_header(const cachemgr_request * req) { static char buf[1024]; size_t stringLength = 0; - const char *str64; if (!req->passwd) return ""; @@ -1171,15 +1170,12 @@ make_auth_header(const cachemgr_request * req) req->user_name ? req->user_name : "", req->passwd); - str64 = base64_encode(buf); - - stringLength += snprintf(buf, sizeof(buf), "Authorization: Basic %s\r\n", str64); + stringLength += snprintf(buf, sizeof(buf), "Authorization: Basic %s\r\n", base64_encode(buf)); assert(stringLength < sizeof(buf)); - snprintf(&buf[stringLength], sizeof(buf) - stringLength, "Proxy-Authorization: Basic %s\r\n", str64); + snprintf(&buf[stringLength], sizeof(buf) - stringLength, "Proxy-Authorization: Basic %s\r\n", base64_encode(buf)); - xxfree(str64); return buf; }