]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3790: cachemgr.cgi crash with authentication
authorReinhard Sojka <reinhard.sojka@parlament.gv.at>
Fri, 22 Feb 2013 11:13:25 +0000 (04:13 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 22 Feb 2013 11:13:25 +0000 (04:13 -0700)
tools/cachemgr.cc

index 83d532c370e24805dae9eae29344b9b5f45ef99b..9c51e6abba610ac0af2de0c355627afff98770e9 100644 (file)
@@ -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;
 }