Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credential modification should check type, not just index. #34841

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2340,8 +2340,9 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch

for (size_t i = 0; i < user.credentials.size(); ++i)
{
// appclusters, 5.2.4.40: user should already be associated with given credentialIndex
if (user.credentials.data()[i].credentialIndex == credential.credentialIndex)
// appclusters, 5.2.4.40: user should already be associated with given credential
if (user.credentials[i].credentialType == credential.credentialType &&
user.credentials[i].credentialIndex == credential.credentialIndex)
{
chip::Platform::ScopedMemoryBuffer<CredentialStruct> newCredentials;
if (!newCredentials.Alloc(user.credentials.size()))
Expand Down Expand Up @@ -2385,7 +2386,7 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch
}
}

// appclusters, 5.2.4.40: if user is not associated with credential index we should return INVALID_COMMAND
// appclusters, 5.2.4.40: if user is not associated with the given credential we should return INVALID_COMMAND
ChipLogProgress(Zcl,
"[ModifyUserCredential] Unable to modify user credential: user is not associated with credential index "
"[endpointId=%d,userIndex=%d,credentialIndex=%d]",
Expand Down
Loading