mirror of https://github.com/ARMmbed/mbed-os.git
TDBStore: Don't copy more data than what we can hold
parent
fe3c3550f9
commit
ce7b196b26
|
|
@ -816,6 +816,10 @@ int TDBStore::copy_record(uint8_t from_area, uint32_t from_offset, uint32_t to_o
|
|||
align_up(header.key_size + header.data_size, _prog_size);;
|
||||
|
||||
|
||||
if (to_offset + total_size > _size) {
|
||||
// We are trying to copy more that the are can hold
|
||||
return MBED_ERROR_MEDIA_FULL;
|
||||
}
|
||||
ret = check_erase_before_write(1 - from_area, to_offset, total_size);
|
||||
if (ret) {
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue