Skip to content

Commit 40373f8

Browse files
committed
Allocate fixed size array for the RSA verifier
ref. https://github.com/earlephilhower/bearssl-esp8266/blob/6105635531027f5b298aa656d44be2289b2d434f/inc/bearssl_rsa.h#L257 (and should've probably changed the type to size_t)
1 parent a396196 commit 40373f8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libraries/ESP8266WiFi/src/BearSSLHelpers.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -938,9 +938,12 @@ uint32_t SigningVerifier::length()
938938
extern "C" bool SigningVerifier_verify(PublicKey *_pubKey, UpdaterHashClass *hash, const void *signature, uint32_t signatureLen) {
939939
if (_pubKey->isRSA()) {
940940
bool ret;
941-
unsigned char vrf[hash->len()];
941+
unsigned char vrf[64];
942+
if (hash->len() > 64) {
943+
return false;
944+
}
942945
br_rsa_pkcs1_vrfy vrfy = br_rsa_pkcs1_vrfy_get_default();
943-
ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), sizeof(vrf), _pubKey->getRSA(), vrf);
946+
ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), hash->len(), _pubKey->getRSA(), vrf);
944947
if (!ret || memcmp(vrf, hash->hash(), sizeof(vrf)) ) {
945948
return false;
946949
} else {

0 commit comments

Comments
 (0)