Skip to content

Commit 27f0f7b

Browse files
committed
Update for Nettle 4.0 base64 API
1 parent b777ca5 commit 27f0f7b

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

src/HttpHeader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ HttpHeader::getAuthToken(Http::HdrType id, const char *auth_scheme) const
14371437
char *decodedAuthToken = result.rawAppendStart(BASE64_DECODE_LENGTH(fieldLen));
14381438
struct base64_decode_ctx ctx;
14391439
base64_decode_init(&ctx);
1440-
size_t decodedLen = 0;
1440+
size_t decodedLen = BASE64_DECODE_LENGTH(fieldLen);
14411441
if (!base64_decode_update(&ctx, &decodedLen, reinterpret_cast<uint8_t*>(decodedAuthToken), fieldLen, field) ||
14421442
!base64_decode_final(&ctx)) {
14431443
return nil;

src/auth/basic/Config.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Auth::Basic::Config::decodeCleartext(const char *httpAuthHeader, const HttpReque
170170
struct base64_decode_ctx ctx;
171171
base64_decode_init(&ctx);
172172

173-
size_t dstLen = 0;
173+
size_t dstLen = sizeof(cleartext);
174174
if (base64_decode_update(&ctx, &dstLen, reinterpret_cast<uint8_t*>(cleartext), srcLen, eek) && base64_decode_final(&ctx)) {
175175
cleartext[dstLen] = '\0';
176176

src/auth/negotiate/SSPI/negotiate_sspi_auth.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ token_decode(size_t *decodedLen, uint8_t decoded[], const char *buf)
124124
{
125125
struct base64_decode_ctx ctx;
126126
base64_decode_init(&ctx);
127+
decodedLen = sizeof(decoded);
127128
if (!base64_decode_update(&ctx, decodedLen, decoded, strlen(buf), buf) ||
128129
!base64_decode_final(&ctx)) {
129130
SEND("BH base64 decode failed");
130131
fprintf(stderr, "ERROR: base64 decoding failed for: '%s'\n", buf);
132+
decodedLen = 0;
131133
return false;
132134
}
133135
return true;

src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ main(int argc, char *const argv[])
658658

659659
struct base64_decode_ctx ctx;
660660
base64_decode_init(&ctx);
661-
size_t dstLen = 0;
661+
size_t dstLen = sizeof(input_token.value);
662662
if (!base64_decode_update(&ctx, &dstLen, static_cast<uint8_t*>(input_token.value), srcLen, b64Token) ||
663663
!base64_decode_final(&ctx)) {
664664
debug((char *) "%s| %s: ERROR: Invalid base64 token [%s]\n", LogTime(), PROGRAM, b64Token);

src/auth/negotiate/wrapper/negotiate_wrapper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ processingLoop(FILE *FDKIN, FILE *FDKOUT, FILE *FDNIN, FILE *FDNOUT)
189189

190190
struct base64_decode_ctx ctx;
191191
base64_decode_init(&ctx);
192-
size_t dstLen = 0;
192+
size_t dstLen = sizeof(token);
193193
if (!base64_decode_update(&ctx, &dstLen, token, strlen(buf+3), buf+3) ||
194194
!base64_decode_final(&ctx)) {
195195
if (debug_enabled)

src/auth/ntlm/fake/ntlm_fake_auth.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
164164
ntlmhdr *packet;
165165
struct base64_decode_ctx ctx;
166166
base64_decode_init(&ctx);
167-
size_t dstLen = 0;
167+
size_t dstLen = sizeof(decodedBuf);
168168
if (buflen > 3 &&
169169
base64_decode_update(&ctx, &dstLen, decodedBuf, buflen-3, buf+3) &&
170170
base64_decode_final(&ctx)) {

0 commit comments

Comments
 (0)