Add few buffer checks

This commit is contained in:
Charles-Edouard de la Vergne 2024-03-14 11:11:59 +01:00
parent 43da863428
commit 7b7bd27fa3
No known key found for this signature in database
GPG Key ID: F12296941B7BB9C6

View File

@ -321,12 +321,15 @@ int gpg_apdu_pso() {
}
key = &G_gpg_vstate.mse_dec->priv_key.ecfp;
gpg_io_fetch_l(&l);
gpg_io_fetch_tl(&t, &l);
if (t != 0x7f49) {
if (l != 37) {
return SW_WRONG_DATA;
}
gpg_io_fetch_tl(&t, &l);
if (t != 0x86) {
if ((t != 0x7f49) || (l != 34)) {
return SW_WRONG_DATA;
}
gpg_io_fetch_tl(&t, &l);
if ((t != 0x86) || (l != 32)) {
return SW_WRONG_DATA;
}