1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Prevent nullptr dereference on OOM (#7823)

This commit is contained in:
Paulo Cabral Sanz
2021-01-12 19:55:57 -03:00
committed by GitHub
parent 0203dea024
commit e938739115
3 changed files with 18 additions and 6 deletions

View File

@ -526,6 +526,10 @@ namespace brssl {
case BR_KEYTYPE_EC:
ek = br_skey_decoder_get_ec(dc.get());
sk = (private_key*)malloc(sizeof * sk);
if (!sk)
{
return nullptr;
}
sk->key_type = BR_KEYTYPE_EC;
sk->key.ec.curve = ek->curve;
sk->key.ec.x = (uint8_t*)malloc(ek->xlen);