mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-04-17 13:48:27 +00:00
Check bounds on update ef.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
c14a12d9d1
commit
1ced9f6267
1 changed files with 3 additions and 0 deletions
|
|
@ -84,6 +84,9 @@ int cmd_update_ef(void) {
|
|||
if (!file_has_data(ef)) {
|
||||
return SW_DATA_INVALID();
|
||||
}
|
||||
if (offset + data_len > file_get_size(ef)) {
|
||||
return SW_WRONG_LENGTH();
|
||||
}
|
||||
|
||||
uint8_t *data_merge = (uint8_t *) calloc(1, offset + data_len);
|
||||
memcpy(data_merge, file_get_data(ef), offset);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue