Skip to content

Commit

Permalink
pw_kvs: Fix out-of-bounds access
Browse files Browse the repository at this point in the history
Change-Id: I28a56f9d4f620a858e24445efd5729ec95b6b710
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/108225
Reviewed-by: Alexei Frolov <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Pigweed-Auto-Submit: Armando Montanez <[email protected]>
  • Loading branch information
armandomontanez authored and CQ Bot Account committed Aug 25, 2022
1 parent 28e3e78 commit c9b6641
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pw_kvs/public/pw_kvs/internal/entry_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ class EntryMetadata {
// Adds a new address to the entry metadata. MUST NOT be called more times
// than allowed by the redundancy.
void AddNewAddress(Address address) {
addresses_[addresses_.size()] = address;
// Each descriptor is given sufficient space in an EntryCache's address
// buffer to meet the redundancy requirements of an EntryCache. This object
// isn't aware of required redundancy, so there's no strict checking that
// this contract is respected.
addresses_ = span<Address>(addresses_.begin(), addresses_.size() + 1);
addresses_[addresses_.size() - 1] = address;
}

// Remove an address from the entry metadata.
Expand Down

0 comments on commit c9b6641

Please sign in to comment.