Skip to content

Commit

Permalink
Add a sanity check for attestation challenge length before returning (#…
Browse files Browse the repository at this point in the history
…15429)

The challenge should always be exactly 16 bytes.
  • Loading branch information
g-coppock authored and pull[bot] committed Feb 25, 2022
1 parent 0b12cd3 commit b88e2df
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ JNI_METHOD(jbyteArray, getAttestationChallenge)
AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle);
err = wrapper->Controller()->GetAttestationChallenge(attestationChallenge);
SuccessOrExit(err);
VerifyOrExit(attestationChallenge.size() == 16, err = CHIP_ERROR_INVALID_ARGUMENT);

err = JniReferences::GetInstance().N2J_ByteArray(env, attestationChallenge.data(), attestationChallenge.size(),
attestationChallengeJbytes);
Expand Down

0 comments on commit b88e2df

Please sign in to comment.