From 18db38a81d6c43efeaa3aa0fefde3ff17516ccbc Mon Sep 17 00:00:00 2001 From: Markus Moeller Date: Mon, 5 Jan 2015 01:57:06 -0800 Subject: [PATCH] negotiate_kerberos_auth: fix token decode typo in rev.13785 --- helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"); -- 2.47.3