Fix a bad parameter in `PEM_read_bio_inner`'s base64 decoding. This would have been an OOB write if `EVP_DecodeFinal` ever wrote anything. But it doesn't write anything, so this CL is a no-op. Change-Id: I4e56ff22b04ece37899ee330a2cf41dc6a6a6964 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/97807 Commit-Queue: Rudolf Polzer <rpolzer@google.com> Reviewed-by: David Benjamin <davidben@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Rudolf Polzer <rpolzer@google.com>
diff --git a/crypto/pem/pem_lib.cc b/crypto/pem/pem_lib.cc index 0e4d75b..83266f4 100644 --- a/crypto/pem/pem_lib.cc +++ b/crypto/pem/pem_lib.cc
@@ -645,7 +645,8 @@ return 0; } int k; - status = EVP_DecodeFinal(&ctx, (unsigned char *)&(dataB->data[bl]), &k); + status = EVP_DecodeFinal(&ctx, + (unsigned char *)&(dataB->data[decoded_length]), &k); if (status < 0) { OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_BASE64_DECODE); return 0;