Skip to content

Commit

Permalink
KVS: Add error check for offset size (#9954)
Browse files Browse the repository at this point in the history
Check the offset size isn't bigger then the read size and return
error.
  • Loading branch information
rgoliver authored and pull[bot] committed Oct 5, 2021
1 parent d1bf454 commit 4703618
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/platform/Linux/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
{
return err;
}
else if (offset_bytes > read_size)
{
return CHIP_ERROR_INVALID_ARGUMENT;
}

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

0 comments on commit 4703618

Please sign in to comment.