From ccd727e094fd723d6fceca2bd91ab16627064bcc Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 8 Jan 2015 15:00:40 -0800 Subject: [PATCH] cachemgr.cgi: exit on base64 decode failures Detected by Coverity Scan. Issue 1261431 --- tools/cachemgr.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 8d55d6d0fe..fbbd433bfa 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -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(buf), strlen(req->pub_auth), reinterpret_cast(req->pub_auth)); - if (!base64_decode_final(&ctx)) { + if (!base64_decode_update(&ctx, &decodedLen, reinterpret_cast(buf), strlen(req->pub_auth), reinterpret_cast(req->pub_auth)) || + !base64_decode_final(&ctx)) { debug("cmgr: base64 decode failure. Incomplete auth token string.\n"); xfree(buf); return; -- 2.47.2