Skip to content

Commit 31d05b3

Browse files
authored
Add invalid data case to tdbstore ram init
1 parent e33e936 commit 31d05b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

features/storage/kvstore/tdbstore/TDBStore.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,11 @@ int TDBStore::build_ram_table()
938938
offset = _master_record_offset;
939939

940940
while (offset < _free_space_offset) {
941+
if (offset == next_offset) {
942+
ret = MBED_ERROR_INVALID_DATA_DETECTED;
943+
goto end;
944+
}
945+
941946
ret = read_record(_active_area, offset, _key_buf, 0, 0, actual_data_size, 0,
942947
true, false, false, true, hash, flags, next_offset);
943948

0 commit comments

Comments
 (0)