Skip to content

Commit c8f2c20

Browse files
committed
Add validation for pid&vid
1 parent 7ad2fc9 commit c8f2c20

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/controller/CommissionerDiscoveryController.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ void CommissionerDiscoveryController::OnUserDirectedCommissioningRequest(UDCClie
155155
return;
156156
}
157157

158+
if (state.GetProductId() == 0 && state.GetVendorId() == 0) {
159+
// this is an invalid request and should be ignored
160+
ChipLogDetail(Controller, "Ignoring the request as it's invalid. product and vendor id cannot be 0");
161+
return;
162+
}
163+
158164
mReady = false;
159165
Platform::CopyString(mCurrentInstance, state.GetInstanceName());
160166
mPendingConsent = true;
@@ -163,7 +169,7 @@ void CommissionerDiscoveryController::OnUserDirectedCommissioningRequest(UDCClie
163169
sizeof(rotatingIdString));
164170
if (err != CHIP_NO_ERROR)
165171
{
166-
ChipLogError(AppServer, "On UDC: could not convert rotating id to hex");
172+
ChipLogError(Controller, "On UDC: could not convert rotating id to hex");
167173
rotatingIdString[0] = '\0';
168174
}
169175

0 commit comments

Comments
 (0)