Skip to content

Commit 11c9d5c

Browse files
committed
Address review comments
1 parent aa3b392 commit 11c9d5c

23 files changed

+108
-66
lines changed

src/ble/BtpEngine.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include <lib/support/BufferReader.h>
3535
#include <lib/support/CodeUtils.h>
36+
#include <lib/support/SafeInt.h>
3637
#include <lib/support/logging/CHIPLogging.h>
3738

3839
// Define below to enable extremely verbose BLE-specific debug logging.
@@ -342,6 +343,7 @@ CHIP_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle &&
342343
if (rx_flags.Has(HeaderFlags::kEndMessage))
343344
{
344345
// Trim remainder, if any, of the received packet buffer based on sender-specified length of reassembled message.
346+
VerifyOrExit(CanCastTo<uint16_t>(mRxBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
345347
int padding = static_cast<uint16_t>(mRxBuf->DataLength()) - mRxLength;
346348

347349
if (padding > 0)
@@ -422,8 +424,9 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s
422424
return false;
423425
}
424426

425-
mTxBuf = std::move(data);
426-
mTxState = kState_InProgress;
427+
mTxBuf = std::move(data);
428+
mTxState = kState_InProgress;
429+
VerifyOrReturnError(CanCastTo<uint16_t>(mTxBuf->DataLength()), false);
427430
mTxLength = static_cast<uint16_t>(mTxBuf->DataLength());
428431

429432
ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send whole message:");

src/ble/tests/TestBtpEngine.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedOnePacket)
6565
};
6666

6767
auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0));
68-
EXPECT_EQ(packet0->DataLength(), 5);
68+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(5));
6969

7070
SequenceNumber_t receivedAck;
7171
bool didReceiveAck;
@@ -79,15 +79,15 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedTwoPacket)
7979
constexpr uint8_t packetData1[] = { to_underlying(BtpEngine::HeaderFlags::kEndMessage), 0x02, 0xff };
8080

8181
auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0));
82-
EXPECT_EQ(packet0->DataLength(), 5);
82+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(5));
8383

8484
SequenceNumber_t receivedAck;
8585
bool didReceiveAck;
8686
EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet0), receivedAck, didReceiveAck), CHIP_NO_ERROR);
8787
EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress);
8888

8989
auto packet1 = System::PacketBufferHandle::NewWithData(packetData1, sizeof(packetData1));
90-
EXPECT_EQ(packet1->DataLength(), 3);
90+
EXPECT_EQ(packet1->DataLength(), static_cast<size_t>(3));
9191

9292
EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet1), receivedAck, didReceiveAck), CHIP_NO_ERROR);
9393
EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_Complete);
@@ -100,21 +100,21 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedThreePacket)
100100
constexpr uint8_t packetData2[] = { to_underlying(BtpEngine::HeaderFlags::kEndMessage), 0x03, 0xff };
101101

102102
auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0));
103-
EXPECT_EQ(packet0->DataLength(), 5);
103+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(5));
104104

105105
SequenceNumber_t receivedAck;
106106
bool didReceiveAck;
107107
EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet0), receivedAck, didReceiveAck), CHIP_NO_ERROR);
108108
EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress);
109109

110110
auto packet1 = System::PacketBufferHandle::NewWithData(packetData1, sizeof(packetData1));
111-
EXPECT_EQ(packet1->DataLength(), 3);
111+
EXPECT_EQ(packet1->DataLength(), static_cast<size_t>(3));
112112

113113
EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet1), receivedAck, didReceiveAck), CHIP_NO_ERROR);
114114
EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress);
115115

116116
auto packet2 = System::PacketBufferHandle::NewWithData(packetData2, sizeof(packetData2));
117-
EXPECT_EQ(packet2->DataLength(), 3);
117+
EXPECT_EQ(packet2->DataLength(), static_cast<size_t>(3));
118118

119119
EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet2), receivedAck, didReceiveAck), CHIP_NO_ERROR);
120120
EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_Complete);
@@ -131,7 +131,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendOnePacket)
131131

132132
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false));
133133
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete);
134-
EXPECT_EQ(packet0->DataLength(), 5);
134+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(5));
135135
}
136136

137137
TEST_F(TestBtpEngine, HandleCharacteristicSendTwoPacket)
@@ -145,11 +145,11 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendTwoPacket)
145145

146146
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false));
147147
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress);
148-
EXPECT_EQ(packet0->DataLength(), 20);
148+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(20));
149149

150150
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false));
151151
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete);
152-
EXPECT_EQ(packet0->DataLength(), 16);
152+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(16));
153153
}
154154

155155
// Send 40-byte payload.
@@ -167,15 +167,15 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendThreePacket)
167167

168168
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false));
169169
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress);
170-
EXPECT_EQ(packet0->DataLength(), 20);
170+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(20));
171171

172172
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false));
173173
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress);
174-
EXPECT_EQ(packet0->DataLength(), 20);
174+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(20));
175175

176176
EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false));
177177
EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete);
178-
EXPECT_EQ(packet0->DataLength(), 8);
178+
EXPECT_EQ(packet0->DataLength(), static_cast<size_t>(8));
179179
}
180180

181181
} // namespace

src/inet/TCPEndPointImplLwIP.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ CHIP_ERROR TCPEndPointImplLwIP::DriveSendingImpl()
350350
do
351351
{
352352
VerifyOrDie(!startOfUnsent.buffer.IsNull());
353-
353+
VerifyOrDie(CanCastTo<uint16_t>(startOfUnsent.buffer->DataLength()));
354354
uint16_t bufDataLen = static_cast<uint16_t>(startOfUnsent.buffer->DataLength());
355355

356356
// Get a pointer to the start of unsent data within the first buffer on the unsent queue.
@@ -508,7 +508,7 @@ CHIP_ERROR TCPEndPointImplLwIP::AckReceive(size_t len)
508508
VerifyOrReturnError(IsConnected(), CHIP_ERROR_INCORRECT_STATE);
509509
CHIP_ERROR res = CHIP_NO_ERROR;
510510

511-
VerifyOrReturnError(len < UINT16_MAX, CHIP_ERROR_INVALID_ARGUMENT);
511+
VerifyOrReturnError(CanCastTo<uint16_t>(len), CHIP_ERROR_INVALID_ARGUMENT);
512512

513513
// Lock LwIP stack
514514
LOCK_TCPIP_CORE();
@@ -572,6 +572,7 @@ TCPEndPointImplLwIP::BufferOffset TCPEndPointImplLwIP::FindStartOfUnsent()
572572
while (leftToSkip > 0)
573573
{
574574
VerifyOrDie(!startOfUnsent.buffer.IsNull());
575+
VerifyOrDie(CanCastTo<uint16_t>(startOfUnsent.buffer->DataLength()));
575576
uint16_t bufDataLen = static_cast<uint16_t>(startOfUnsent.buffer->DataLength());
576577
if (leftToSkip >= bufDataLen)
577578
{

src/inet/TCPEndPointImplSockets.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ CHIP_ERROR TCPEndPointImplSockets::DriveSendingImpl()
483483

484484
while (!mSendQueue.IsNull())
485485
{
486-
uint32_t bufLen = static_cast<uint32_t>(mSendQueue->DataLength());
486+
size_t bufLen = mSendQueue->DataLength();
487487

488488
ssize_t lenSentRaw = send(mSocket, mSendQueue->Start(), bufLen, sendFlags);
489489

@@ -496,14 +496,13 @@ CHIP_ERROR TCPEndPointImplSockets::DriveSendingImpl()
496496
break;
497497
}
498498

499-
if (lenSentRaw < 0 || bufLen < static_cast<uint32_t>(lenSentRaw))
499+
if (lenSentRaw < 0 || bufLen < static_cast<size_t>(lenSentRaw))
500500
{
501501
err = CHIP_ERROR_INCORRECT_STATE;
502502
break;
503503
}
504504

505-
// Cast is safe because bufLen is uint32_t.
506-
uint32_t lenSent = static_cast<uint32_t>(lenSentRaw);
505+
size_t lenSent = static_cast<size_t>(lenSentRaw);
507506

508507
// Mark the connection as being active.
509508
MarkActive();

src/inet/UDPEndPointImplOpenThread.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ CHIP_ERROR UDPEndPointImplOT::SendMsgImpl(const IPPacketInfo * aPktInfo, System:
225225
otMessageInfo messageInfo;
226226

227227
// For now the entire message must fit within a single buffer.
228-
VerifyOrReturnError(!msg->HasChainedBuffer(), CHIP_ERROR_MESSAGE_TOO_LONG);
228+
VerifyOrReturnError(!msg->HasChainedBuffer() && msg->DataLength() <= UINT16_MAX, CHIP_ERROR_MESSAGE_TOO_LONG);
229229

230230
memset(&messageInfo, 0, sizeof(messageInfo));
231231

src/inet/UDPEndPointImplSockets.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void UDPEndPointImplSockets::HandlePendingIO(System::SocketEvents events)
610610

611611
ssize_t rcvLen = recvmsg(mSocket, &msgHeader, MSG_DONTWAIT);
612612

613-
if (rcvLen < 0)
613+
if (rcvLen == -1)
614614
{
615615
lStatus = CHIP_ERROR_POSIX(errno);
616616
}

src/inet/tests/TestInetLayerCommon.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include <inet/IPPacketInfo.h>
3737
#include <lib/support/CodeUtils.h>
38+
#include <lib/support/SafeInt.h>
3839

3940
#include "TestInetCommon.h"
4041

@@ -259,6 +260,7 @@ static bool HandleDataReceived(const PacketBufferHandle & aBuffer, TransferStats
259260
// If we are accumulating stats by packet rather than by size,
260261
// then increment by one (1) rather than the total buffer length.
261262

263+
VerifyOrReturnError(CanCastTo<uint32_t>(lTotalDataLength), false);
262264
aStats.mReceive.mActual += ((aStatsByPacket) ? 1 : static_cast<uint32_t>(lTotalDataLength));
263265

264266
return true;

src/lib/core/tests/TestTLV.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ void TestDupBytes(nlTestSuite * inSuite, TLVReader & reader, Tag tag, const uint
272272
}
273273

274274
void TestBufferContents(nlTestSuite * inSuite, const System::PacketBufferHandle & buffer, const uint8_t * expectedVal,
275-
uint32_t expectedLen)
275+
size_t expectedLen)
276276
{
277277
System::PacketBufferHandle buf = buffer.Retain();
278278
while (!buf.IsNull())
279279
{
280-
uint32_t len = static_cast<uint32_t>(buf->DataLength());
280+
size_t len = buf->DataLength();
281281
NL_TEST_ASSERT(inSuite, len <= expectedLen);
282282

283283
NL_TEST_ASSERT(inSuite, memcmp(buf->Start(), expectedVal, len) == 0);

src/messaging/tests/echo/echo_requester.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void HandleEchoResponseReceived(chip::Messaging::ExchangeContext * ec, chip::Sys
183183

184184
gEchoRespCount++;
185185

186-
printf("Echo Response: %" PRIu64 "/%" PRIu64 "(%.2f%%) len=%u time=%.3fs\n", gEchoRespCount, gEchoCount,
186+
printf("Echo Response: %" PRIu64 "/%" PRIu64 "(%.2f%%) len=%" PRIu32 "time=%.3fs\n", gEchoRespCount, gEchoCount,
187187
static_cast<double>(gEchoRespCount) * 100 / static_cast<double>(gEchoCount),
188188
static_cast<uint32_t>(payload->DataLength()),
189189
static_cast<double>(chip::System::Clock::Milliseconds32(transitTime).count()) / 1000);

src/messaging/tests/echo/echo_responder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ chip::SessionHolder gSession;
4949
// Callback handler when a CHIP EchoRequest is received.
5050
void HandleEchoRequestReceived(chip::Messaging::ExchangeContext * ec, chip::System::PacketBufferHandle && payload)
5151
{
52-
printf("Echo Request, len=%u ... sending response.\n", static_cast<uint32_t>(payload->DataLength()));
52+
printf("Echo Request, len=%" PRIu32 "... sending response.\n", static_cast<uint32_t>(payload->DataLength()));
5353
}
5454

5555
} // namespace

src/platform/ESP32/nimble/BLEManagerImpl.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#endif
3636
#include <ble/CHIPBleServiceData.h>
3737
#include <lib/support/CodeUtils.h>
38+
#include <lib/support/SafeInt.h>
3839
#include <lib/support/logging/CHIPLogging.h>
3940
#include <platform/CommissionableDataProvider.h>
4041
#include <platform/DeviceInstanceInfoProvider.h>
@@ -591,6 +592,10 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
591592

592593
ESP_LOGD(TAG, "Sending indication for CHIPoBLE TX characteristic (con %u, len %u)", conId, data->DataLength());
593594

595+
// For BLE, the buffer is capped at UINT16_MAX. Nevertheless, have a verify
596+
// check before the cast to uint16_t.
597+
VerifyOrExit(CanCastTo<uint16_t>(data->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
598+
594599
om = ble_hs_mbuf_from_flat(data->Start(), static_cast<uint16_t>(data->DataLength()));
595600
if (om == NULL)
596601
{

src/platform/Zephyr/BLEManagerImpl.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <ble/CHIPBleServiceData.h>
3131
#include <lib/support/CHIPMemString.h>
3232
#include <lib/support/CodeUtils.h>
33+
#include <lib/support/SafeInt.h>
3334
#include <lib/support/logging/CHIPLogging.h>
3435
#include <platform/DeviceInstanceInfoProvider.h>
3536
#include <platform/internal/BLEManager.h>
@@ -707,7 +708,8 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
707708
params->attr = &sChipoBleAttributes[kCHIPoBLE_CCC_AttributeIndex];
708709
params->func = HandleTXIndicated;
709710
params->data = pBuf->Start();
710-
params->len = static_cast<uint16_t>(pBuf->DataLength());
711+
VerifyOrExit(CanCastTo<uint16_t>(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
712+
params->len = static_cast<uint16_t>(pBuf->DataLength());
711713

712714
status = bt_gatt_indicate(conId, params);
713715
VerifyOrExit(status == 0, err = MapErrorZephyr(status));
@@ -885,6 +887,8 @@ ssize_t BLEManagerImpl::HandleC3Read(struct bt_conn * conId, const struct bt_gat
885887
return 0;
886888
}
887889

890+
// For BLE, the max payload size is limited to UINT16_MAX since the length
891+
// field is 2 bytes long. So, the cast to uint16_t should be fine.
888892
return bt_gatt_attr_read(conId, attr, buf, len, offset, sInstance.c3CharDataBufferHandle->Start(),
889893
static_cast<uint16_t>(sInstance.c3CharDataBufferHandle->DataLength()));
890894
}

src/platform/android/BLEManagerImpl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch
384384
err = JniReferences::GetInstance().N2J_ByteArray(env, static_cast<const uint8_t *>(charId->bytes), 16, charIdObj);
385385
SuccessOrExit(err);
386386

387+
VerifyOrExit(CanCastTo<uint16_t>(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
387388
err = JniReferences::GetInstance().N2J_ByteArray(env, pBuf->Start(), static_cast<uint16_t>(pBuf->DataLength()),
388389
characteristicDataObj);
389390
SuccessOrExit(err);

src/platform/bouffalolab/common/BLEManagerImpl.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <ble/CHIPBleServiceData.h>
2525
#include <lib/support/CHIPMemString.h>
26+
#include <lib/support/SafeInt.h>
2627
#include <platform/DeviceInstanceInfoProvider.h>
2728
#include <platform/internal/BLEManager.h>
2829
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
@@ -669,7 +670,10 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
669670
params->attr = &sChipoBleAttributes[kCHIPoBLE_CCC_AttributeIndex];
670671
params->func = HandleTXIndicated;
671672
params->data = pBuf->Start();
672-
params->len = static_cast<uint16_t>(pBuf->DataLength());
673+
// For BLE, the buffer is capped at UINT16_MAX. Nevertheless, have a verify
674+
// check before the cast to uint16_t.
675+
VerifyOrExit(CanCastTo<uint16_t>(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
676+
params->len = static_cast<uint16_t>(pBuf->DataLength());
673677

674678
status = bt_gatt_indicate(conId, params);
675679
VerifyOrExit(status == 0, err = MapErrorZephyr(status));
@@ -848,6 +852,8 @@ ssize_t BLEManagerImpl::HandleC3Read(struct bt_conn * conId, const struct bt_gat
848852
return 0;
849853
}
850854

855+
// For BLE, the max payload size is limited to UINT16_MAX since the length
856+
// field is 2 bytes long. So, the cast to uint16_t should be fine.
851857
return bt_gatt_attr_read(conId, attr, buf, len, offset, sInstance.c3CharDataBufferHandle->Start(),
852858
static_cast<uint16_t>(sInstance.c3CharDataBufferHandle->DataLength()));
853859
}

src/platform/mbed/BLEManagerImpl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include <ble/CHIPBleServiceData.h>
3434
#include <lib/support/CodeUtils.h>
35+
#include <lib/support/SafeInt.h>
3536
#include <lib/support/logging/CHIPLogging.h>
3637
#include <platform/CommissionableDataProvider.h>
3738
#include <platform/internal/BLEManager.h>
@@ -984,6 +985,9 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
984985
ble::GattServer & gatt_server = ble::BLE::Instance().gattServer();
985986
ble::attribute_handle_t att_handle;
986987

988+
// For BLE, the buffer is capped at UINT16_MAX.
989+
VerifyOrExit(CanCastTo<uint16_t>(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG);
990+
987991
// No need to do anything fancy here. Only 3 handles are used in this impl.
988992
if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX))
989993
{

src/protocols/secure_channel/CASESession.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,8 @@ CHIP_ERROR CASESession::HandleSigma3a(System::PacketBufferHandle && msg)
15791579
TLV::TLVReader decryptedDataTlvReader;
15801580
TLV::TLVType containerType = TLV::kTLVType_Structure;
15811581

1582-
const uint8_t * buf = msg->Start();
1583-
const uint32_t bufLen = static_cast<uint32_t>(msg->DataLength());
1582+
const uint8_t * buf = msg->Start();
1583+
const size_t bufLen = msg->DataLength();
15841584

15851585
constexpr size_t kCaseOverheadForFutureTbeData = 128;
15861586

src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd
255255
PayloadHeader payloadHeader;
256256
ReturnOnFailure(payloadHeader.DecodeAndConsume(msg));
257257

258-
ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%u", static_cast<uint16_t>(msg->DataLength()));
258+
ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%" PRIu32, static_cast<uint32_t>(msg->DataLength()));
259259

260260
uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes];
261261
size_t udcPayloadLength = std::min<size_t>(msg->DataLength(), sizeof(udcPayload));

src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void UserDirectedCommissioningServer::OnMessageReceived(const Transport::PeerAdd
5252
PayloadHeader payloadHeader;
5353
ReturnOnFailure(payloadHeader.DecodeAndConsume(msg));
5454

55-
ChipLogProgress(AppServer, "IdentityDeclaration DataLength()=%u", static_cast<uint16_t>(msg->DataLength()));
55+
ChipLogProgress(AppServer, "IdentityDeclaration DataLength()=%" PRIu32, static_cast<uint32_t>(msg->DataLength()));
5656

5757
uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes];
5858
size_t udcPayloadLength = std::min<size_t>(msg->DataLength(), sizeof(udcPayload));

0 commit comments

Comments
 (0)