Merge pull request #3351 from AlxCzl/fix-3347

Fix NULL dereference (#3347) in emv_pki_decode_message
This commit is contained in:
Iceman authored and GitHub committed 2026-06-02 17:20:51 +02:00
commit 95b73e2605
1 file changed
+5 -4
+5 -4
View File
@@ -75,10 +75,11 @@ static unsigned char *emv_pki_decode_message(const struct emv_pk *enc_pk,
data = crypto_pk_encrypt(kcp, cert_tlv->value, cert_tlv->len, &data_len);
crypto_pk_close(kcp);
/* if (true){
PrintAndLogEx(SUCCESS, "Recovered data:\n");
print_buffer(data, data_len, 1);
}*/
if (data == NULL || data_len < 3) {
PrintAndLogEx(WARNING, "ERROR: Certificate decrypt failed");
free(data);
return NULL;
}
if (data[data_len - 1] != 0xbc || data[0] != 0x6a || data[1] != msgtype) {
PrintAndLogEx(WARNING, "ERROR: Certificate format");