Skip to content

Commit 1282766

Browse files
rgoliverpull[bot]
rgoliver
authored andcommitted
KVS: Add error check for offset size (#9954)
Check the offset size isn't bigger then the read size and return error.
1 parent 0ca24ec commit 1282766

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/platform/Linux/KeyValueStoreManagerImpl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
5656
{
5757
return err;
5858
}
59+
else if (offset_bytes > read_size)
60+
{
61+
return CHIP_ERROR_INVALID_ARGUMENT;
62+
}
5963

6064
Platform::ScopedMemoryBuffer<uint8_t> buf;
6165
VerifyOrReturnError(buf.Alloc(read_size), CHIP_ERROR_NO_MEMORY);

0 commit comments

Comments
 (0)