mirror of
https://github.com/polhenarejos/pico-fido.git
synced 2024-09-20 03:10:10 +00:00
Fix potential crash invoking OTP.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
a0d9ad7a3a
commit
8d49ed5ffc
@ -566,6 +566,8 @@ int otp_hid_set_report_cb(uint8_t itf,
|
||||
uint16_t residual_crc = calculate_crc(otp_frame_rx, 64), rcrc = (otp_frame_rx[66] << 8 | otp_frame_rx[65]);
|
||||
uint8_t slot_id = otp_frame_rx[64];
|
||||
if (residual_crc == rcrc) {
|
||||
uint8_t hdr[5];
|
||||
apdu.header = hdr;
|
||||
apdu.data = otp_frame_rx;
|
||||
apdu.nc = 64;
|
||||
apdu.rdata = otp_frame_tx;
|
||||
@ -617,8 +619,8 @@ uint16_t otp_hid_get_report_cb(uint8_t itf,
|
||||
otp_curr_seq = otp_exp_seq = 0;
|
||||
}
|
||||
else {
|
||||
res_APDU = buffer;
|
||||
otp_status();
|
||||
memcpy(buffer, res_APDU, 7);
|
||||
}
|
||||
|
||||
return reqlen;
|
||||
|
Loading…
Reference in New Issue
Block a user