diff --git a/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp b/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp index 0c1dac40832e96..dd3ed3664bcd2a 100644 --- a/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp +++ b/examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp @@ -99,6 +99,11 @@ bool MediaInputManager::HandleRenameInput(const uint8_t index, const chip::CharS { if (input.index == index) { + if (sizeof(mCharDataBuffer[index]) < name.size()) + { + return mediaInputRenamed; + } + mediaInputRenamed = true; memcpy(this->Data(index), name.data(), name.size()); input.name = chip::CharSpan(this->Data(index), name.size());