Merge pull request #2028 from kormax/vas-memory-leak

Fix potential memory leak in VAS implementation
This commit is contained in:
Iceman authored and GitHub committed 2023-07-10 10:14:59 +02:00
commit e1343382b5
1 file changed
+3 -2
+3 -2
View File
@@ -187,18 +187,19 @@ static int LoadReaderPrivateKey(uint8_t *buf, size_t bufLen, mbedtls_ecp_keypair
return PM3_EINVARG;
}
tlvdb_free(derRoot);
if (mbedtls_ecp_point_read_binary(&privKey->grp, &privKey->Q, pubkeyCoordsTlv->value + 1, 65)) {
PrintAndLogEx(FAILED, "Failed to read in public key coordinates");
tlvdb_free(derRoot);
return PM3_EINVARG;
}
if (mbedtls_ecp_check_pubkey(&privKey->grp, &privKey->Q)) {
PrintAndLogEx(FAILED, "VAS protocol requires an elliptic key on the P-256 curve");
tlvdb_free(derRoot);
return PM3_EINVARG;
}
tlvdb_free(derRoot);
return PM3_SUCCESS;
}