Align data in case it's not.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2024-10-27 02:14:51 +02:00
parent ccec83dfb1
commit 2856ec6917
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -273,6 +273,10 @@ int cmd_extras() {
if (apdu.nc % 2) {
return SW_WRONG_DATA();
}
if ((uintptr_t)apdu.data & 1) { // Not aligned
memmove(apdu.data - 1, apdu.data, apdu.nc);
apdu.data--;
}
int ret = otp_write_data(row, apdu.data, apdu.nc);
if (ret != 0) {
return SW_EXEC_ERROR();