From 06dd3303209dff1e3e218c6f2af54f611450266a Mon Sep 17 00:00:00 2001 From: Kyle Kearney Date: Tue, 20 Aug 2019 17:12:18 -0700 Subject: [PATCH] Fix missing offset in TBStore read from flash This could cause incomplete data retrieval and mismatch when reading data in more than one chunk, because every chunk would be read to the same location at the beginning of the output buffer. --- features/storage/kvstore/tdbstore/TDBStore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/storage/kvstore/tdbstore/TDBStore.cpp b/features/storage/kvstore/tdbstore/TDBStore.cpp index eda5867e20..24d797f0d5 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.cpp +++ b/features/storage/kvstore/tdbstore/TDBStore.cpp @@ -1418,7 +1418,7 @@ int TDBStore::do_reserved_data_get(void *reserved_data, size_t reserved_data_buf while (actual_size) { uint32_t chunk = std::min(work_buf_size, (uint32_t) actual_size); - ret = read_area(_active_area, offset, chunk, buf); + ret = read_area(_active_area, offset, chunk, buf + offset); if (ret) { return ret; }