diff --git a/src/app/icd/server/ICDMonitoringTable.h b/src/app/icd/server/ICDMonitoringTable.h index 942c56fda45e71..d2bd178fc10c4c 100644 --- a/src/app/icd/server/ICDMonitoringTable.h +++ b/src/app/icd/server/ICDMonitoringTable.h @@ -34,7 +34,7 @@ using SymmetricKeystore = SessionKeystore; namespace chip { -inline constexpr size_t kICDMonitoringBufferSize = 60; +inline constexpr size_t kICDMonitoringBufferSize = 63; struct ICDMonitoringEntry : public PersistentData { @@ -129,8 +129,7 @@ struct ICDMonitoringTable { ICDMonitoringTable(PersistentStorageDelegate & storage, FabricIndex fabric, uint16_t limit, Crypto::SymmetricKeystore * symmetricKeystore) : - mStorage(&storage), - mFabric(fabric), mLimit(limit), mSymmetricKeystore(symmetricKeystore) + mStorage(&storage), mFabric(fabric), mLimit(limit), mSymmetricKeystore(symmetricKeystore) {} /** diff --git a/src/app/icd/server/tests/TestICDMonitoringTable.cpp b/src/app/icd/server/tests/TestICDMonitoringTable.cpp index 177f8caba507e1..81fcb2af18a250 100644 --- a/src/app/icd/server/tests/TestICDMonitoringTable.cpp +++ b/src/app/icd/server/tests/TestICDMonitoringTable.cpp @@ -43,6 +43,8 @@ constexpr uint64_t kClientNodeId13 = 0x100003; constexpr uint64_t kClientNodeId21 = 0x200001; constexpr uint64_t kClientNodeId22 = 0x200002; +constexpr uint64_t kClientNodeMaxValue = std::numeric_limits::max(); + constexpr uint8_t kKeyBuffer0a[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; constexpr uint8_t kKeyBuffer0b[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -98,6 +100,20 @@ TEST(TestICDMonitoringTable, TestEntryAssignationOverload) EXPECT_TRUE(entry2.IsKeyEquivalent(ByteSpan(kKeyBuffer1a))); } +TEST(TestICDMonitoringTable, TestEntryMaximumSize) +{ + TestPersistentStorageDelegate storage; + TestSessionKeystoreImpl keystore; + ICDMonitoringTable table(storage, kTestFabricIndex1, kMaxTestClients1, &keystore); + + ICDMonitoringEntry entry(&keystore); + entry.checkInNodeID = kClientNodeMaxValue; + entry.monitoredSubject = kClientNodeMaxValue; + entry.clientType = ClientTypeEnum::kPermanent; + EXPECT_EQ(CHIP_NO_ERROR, entry.SetKey(ByteSpan(kKeyBuffer1a))); + EXPECT_EQ(CHIP_NO_ERROR, table.Set(0, entry)); +} + TEST(TestICDMonitoringTable, TestEntryKeyFunctions) { TestSessionKeystoreImpl keystore;