]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cachemgr.cgi: exit on base64 decode failures
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Jan 2015 23:00:40 +0000 (15:00 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Jan 2015 23:00:40 +0000 (15:00 -0800)
  Detected by Coverity Scan. Issue 1261431

tools/cachemgr.cc

index 8d55d6d0fed7b27abe443e0954e91efeb36dfa9d..fbbd433bfa7fe0e677be2eea7515538c7c182a3b 100644 (file)
@@ -1104,8 +1104,8 @@ decode_pub_auth(cachemgr_request * req)
     buf = (char*)xmalloc(decodedLen);
     struct base64_decode_ctx ctx;
     base64_decode_init(&ctx);
-    base64_decode_update(&ctx, &decodedLen, reinterpret_cast<uint8_t*>(buf), strlen(req->pub_auth), reinterpret_cast<const uint8_t*>(req->pub_auth));
-    if (!base64_decode_final(&ctx)) {
+    if (!base64_decode_update(&ctx, &decodedLen, reinterpret_cast<uint8_t*>(buf), strlen(req->pub_auth), reinterpret_cast<const uint8_t*>(req->pub_auth)) ||
+            !base64_decode_final(&ctx)) {
         debug("cmgr: base64 decode failure. Incomplete auth token string.\n");
         xfree(buf);
         return;