Skip to content

Commit e3c72fb

Browse files
seism0saurushasenradball
authored andcommitted
Only check the actual used lenght of the hash. (esp8266#8709)
1 parent fefcda6 commit e3c72fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/ESP8266WiFi/src/BearSSLHelpers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ extern "C" bool SigningVerifier_verify(PublicKey *_pubKey, UpdaterHashClass *has
945945
}
946946
br_rsa_pkcs1_vrfy vrfy = br_rsa_pkcs1_vrfy_get_default();
947947
bool ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), hash->len(), _pubKey->getRSA(), vrf);
948-
if (!ret || memcmp(vrf, hash->hash(), sizeof(vrf)) ) {
948+
if (!ret || memcmp(vrf, hash->hash(), std::min(HashLengthMax, hash->len())) ) {
949949
return false;
950950
} else {
951951
return true;

0 commit comments

Comments
 (0)