forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support raw ByteSpan values correctly in SafeAttributePersistenceProv…
…ider (project-chip#34306) * Support raw ByteSpan values correctly in SafeattributePersistenceProvider The DefaultAttributePersistenceProvider implementation of SafeReadValue() had the undocumented behavior of enforcing that the value exactly filled the provided buffer. This does not make sense for an API that purports to store general ByteSpan values. Instead move this validation into ReadScalarValue() in SafeAttributePersistenceProvider, and separate InternalReadValue() into one method that does the only the actual read, and a second one that performs the additional validation for reading typed ember attributes (strings with length prefixes etc). Use the former one from SafeReadValue(). Also fix possible out of bounds access when reading ember strings by ensuring we have read the length byte(s) before attempting to interpret them. * Take integral argument T by value * Add test
- Loading branch information
1 parent
077ca3c
commit aa97f26
Showing
4 changed files
with
45 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters