Skip to content

Commit

Permalink
Handle opCredsIssuer initialization failure (#26337)
Browse files Browse the repository at this point in the history
* Handle opCredsIssuer initialization failure in
AndroidDeviceControllerWrapper

If Initialization fails this will cause crashes later in the flow.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Aug 3, 2023
1 parent bae5f72 commit 1059151
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/controller/java/AndroidDeviceControllerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,16 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(
}
initParams.opCertStore = &wrapper->mOpCertStore;
#ifdef JAVA_MATTER_CONTROLLER_TEST
opCredsIssuer->Initialize(wrapper->mExampleStorage);
err = opCredsIssuer->Initialize(wrapper->mExampleStorage);
#else
// TODO: Init IPK Epoch Key in opcreds issuer, so that commissionees get the right IPK
opCredsIssuer->Initialize(*wrapper.get(), &wrapper->mAutoCommissioner, wrapper.get()->mJavaObjectRef);
err = opCredsIssuer->Initialize(*wrapper.get(), &wrapper->mAutoCommissioner, wrapper.get()->mJavaObjectRef);
#endif
if (err != CHIP_NO_ERROR)
{
*errInfoOnFailure = err;
return nullptr;
}

Platform::ScopedMemoryBuffer<uint8_t> noc;
if (!noc.Alloc(kMaxCHIPDERCertLength))
Expand Down

0 comments on commit 1059151

Please sign in to comment.