[Infineon] Fix CYW30739 KVS. (#23145)

diff --git a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp
index f139f6b..f78d639 100644
--- a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp
+++ b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.cpp
@@ -46,6 +46,7 @@
     {
         KeyStorage keyStorage;
         size_t keyStorageLength;
+        memset(keyStorage.mKey, 0, sizeof(keyStorage.mKey));
         err = CYW30739Config::ReadConfigValueBin(CYW30739ConfigKey(Config::kChipKvsKey_KeyBase, configID), &keyStorage,
                                                  sizeof(keyStorage), keyStorageLength);
         if (err != CHIP_NO_ERROR)
@@ -188,7 +189,7 @@
 
 bool KeyValueStoreManagerImpl::KeyStorage::IsMatchKey(const char * key) const
 {
-    return strncmp(mKey, key, sizeof(mKey)) == 0;
+    return strcmp(mKey, key) == 0;
 }
 
 KeyValueStoreManagerImpl::KeyConfigIdEntry * KeyValueStoreManagerImpl::AllocateEntry(const char * key)
diff --git a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.h b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.h
index 7c90455..9d16dd4 100644
--- a/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.h
+++ b/src/platform/Infineon/CYW30739/KeyValueStoreManagerImpl.h
@@ -61,16 +61,16 @@
     {
         KeyStorage(const char * key = nullptr);
 
-        constexpr size_t GetSize() const { return sizeof(mValueSize) + strnlen(mKey, sizeof(mKey)); }
+        constexpr size_t GetSize() const { return sizeof(mValueSize) + strlen(mKey); }
         bool IsMatchKey(const char * key) const;
 
         uint16_t mValueSize;
-        char mKey[PersistentStorageDelegate::kKeyLengthMax];
+        char mKey[PersistentStorageDelegate::kKeyLengthMax + 1];
     };
 
     struct KeyConfigIdEntry : public slist_node_t
     {
-        KeyConfigIdEntry(uint8_t configID, const KeyStorage & keyStorage) : mConfigID(configID), mStorage(keyStorage) {}
+        KeyConfigIdEntry(uint8_t configID, const KeyStorage & keyStorage) : mStorage(keyStorage), mConfigID(configID) {}
 
         constexpr Config::Key GetValueConfigKey() const
         {
@@ -85,8 +85,8 @@
         constexpr uint16_t GetValueSize() const { return mStorage.mValueSize; }
         constexpr void SetValueSize(uint16_t valueSize) { mStorage.mValueSize = valueSize; }
 
-        uint8_t mConfigID;
         KeyStorage mStorage;
+        uint8_t mConfigID;
     };
 
     KeyConfigIdEntry * AllocateEntry(const char * key);