Skip to content

Commit bb8a6ef

Browse files
authored
Fix data corruption/mangling in DeviceCommissioner::SendOperationalCertificate (#7309)
1 parent 51e396e commit bb8a6ef

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/controller/CHIPDeviceController.cpp

+2-15
Original file line numberDiff line numberDiff line change
@@ -1218,21 +1218,8 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(Device * device, const
12181218
Callback::Cancelable * successCallback = mOpCertResponseCallback.Cancel();
12191219
Callback::Cancelable * failureCallback = mOnCertFailureCallback.Cancel();
12201220

1221-
// TODO - Update ZAP to use 16 bit length for OCTET_STRING. This is a temporary hack, as OCTET_STRING only supports 8 bit
1222-
// strings.
1223-
if (opCertBuf.size() >= UINT8_MAX)
1224-
{
1225-
ByteSpan tempCertFragment(&opCertBuf.data()[UINT8_MAX], opCertBuf.size() - UINT8_MAX);
1226-
ByteSpan opCertFragment(opCertBuf.data(), UINT8_MAX);
1227-
1228-
ReturnErrorOnFailure(cluster.AddOpCert(successCallback, failureCallback, opCertFragment, tempCertFragment,
1229-
ByteSpan(nullptr, 0), mLocalDeviceId, 0));
1230-
}
1231-
else
1232-
{
1233-
ReturnErrorOnFailure(cluster.AddOpCert(successCallback, failureCallback, opCertBuf, ByteSpan(nullptr, 0),
1234-
ByteSpan(nullptr, 0), mLocalDeviceId, 0));
1235-
}
1221+
ReturnErrorOnFailure(
1222+
cluster.AddOpCert(successCallback, failureCallback, opCertBuf, icaCertBuf, ByteSpan(nullptr, 0), mLocalDeviceId, 0));
12361223

12371224
ChipLogProgress(Controller, "Sent operational certificate to the device");
12381225

0 commit comments

Comments
 (0)