TDBStore: Don't copy more data than what we can hold

pull/11987/head
Seppo Takalo 2019-11-27 18:32:39 +02:00
parent fe3c3550f9
commit ce7b196b26
1 changed files with 4 additions and 0 deletions

View File

@ -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;