Skip to content

Commit 3899de2

Browse files
committed
check for userInStorage.currentCredentialCount <= kMaxCredentialsPerUser
1 parent dd3a8e5 commit 3899de2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/lock-app/silabs/src/LockManager.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, Ember
372372
user.modificationSource = DlAssetSource::kMatterIM;
373373
user.lastModifiedBy = userInStorage.lastModifiedBy;
374374

375+
// Ensure userInStorage.currentCredentialCount <= kMaxCredentialsPerUser to avoid buffer overflow
376+
VerifyOrReturnValue(userInStorage.currentCredentialCount <= kMaxCredentialsPerUser, false);
377+
375378
// Get credential struct from nvm3
376379
chip::StorageKeyName credentialKey = LockUserCredentialMap(userIndex);
377380

0 commit comments

Comments
 (0)