From: Markus Moeller Date: Mon, 5 Jan 2015 09:57:06 +0000 (-0800) Subject: negotiate_kerberos_auth: fix token decode typo in rev.13785 X-Git-Tag: merge-candidate-3-v1~375 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=18db38a81d6c43efeaa3aa0fefde3ff17516ccbc;p=thirdparty%2Fsquid.git negotiate_kerberos_auth: fix token decode typo in rev.13785 --- diff --git a/helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc b/helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc index ef2c780b22..e3b030ffeb 100644 --- a/helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc +++ b/helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc @@ -657,15 +657,16 @@ main(int argc, char *const argv[]) continue; } const uint8_t *b64Token = reinterpret_cast(buf+3); - input_token.length = BASE64_DECODE_LENGTH(strlen(buf+3)); - debug((char *) "%s| %s: DEBUG: Decode '%s' (decoded length: %d).\n", + const size_t srcLen = strlen(b64Token); + input_token.length = BASE64_DECODE_LENGTH(srcLen); + debug((char *) "%s| %s: DEBUG: Decode '%s' (decoded length estimate: %d).\n", LogTime(), PROGRAM, b64Token, (int) input_token.length); input_token.value = xmalloc(input_token.length); struct base64_decode_ctx ctx; base64_decode_init(&ctx); size_t dstLen = 0; - if (!base64_decode_update(&ctx, &dstLen, static_cast(input_token.value), input_token.length, b64Token) || + if (!base64_decode_update(&ctx, &dstLen, static_cast(input_token.value), srcLen, b64Token) || !base64_decode_final(&ctx)) { debug((char *) "%s| %s: ERROR: Invalid base64 token [%s]\n", LogTime(), PROGRAM, b64Token); fprintf(stdout, "BH Invalid negotiate request token\n");