fix(base64): only check padding if leftover index is set (#25854)

This commit is contained in:
Gregory Anders 2023-10-31 10:13:45 -05:00 committed by GitHub
parent 224f303ee5
commit 746a153bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,7 +180,7 @@ char *base64_decode(const char *src, size_t src_len)
goto invalid; goto invalid;
} }
if (leftover_i >= -1) { if (leftover_i > -1) {
int padding_len = acc_len / 2; int padding_len = acc_len / 2;
int padding_chars = 0; int padding_chars = 0;
for (; (size_t)leftover_i < src_len; leftover_i++) { for (; (size_t)leftover_i < src_len; leftover_i++) {