Skip to content

Commit ce7b196

Browse files
author
Seppo Takalo
committed
TDBStore: Don't copy more data than what we can hold
1 parent fe3c355 commit ce7b196

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

features/storage/kvstore/tdbstore/TDBStore.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ int TDBStore::copy_record(uint8_t from_area, uint32_t from_offset, uint32_t to_o
816816
align_up(header.key_size + header.data_size, _prog_size);;
817817

818818

819+
if (to_offset + total_size > _size) {
820+
// We are trying to copy more that the are can hold
821+
return MBED_ERROR_MEDIA_FULL;
822+
}
819823
ret = check_erase_before_write(1 - from_area, to_offset, total_size);
820824
if (ret) {
821825
return ret;

0 commit comments

Comments
 (0)