Skip to content

Commit

Permalink
TV App - Add validation for invalid product and vendor id. (#35157)
Browse files Browse the repository at this point in the history
* Add validation for pid&vid

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
lazarkov and restyled-commits authored Aug 26, 2024
1 parent acba7f8 commit 7ddba36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controller/CommissionerDiscoveryController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ void CommissionerDiscoveryController::OnUserDirectedCommissioningRequest(UDCClie
return;
}

if (state.GetProductId() == 0 && state.GetVendorId() == 0)
{
// this is an invalid request and should be ignored
ChipLogDetail(Controller, "Ignoring the request as it's invalid. product and vendor id cannot be 0");
return;
}

mReady = false;
Platform::CopyString(mCurrentInstance, state.GetInstanceName());
mPendingConsent = true;
Expand All @@ -163,7 +170,7 @@ void CommissionerDiscoveryController::OnUserDirectedCommissioningRequest(UDCClie
sizeof(rotatingIdString));
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "On UDC: could not convert rotating id to hex");
ChipLogError(Controller, "On UDC: could not convert rotating id to hex");
rotatingIdString[0] = '\0';
}
else
Expand Down

0 comments on commit 7ddba36

Please sign in to comment.