From b159e9c694038c06a074943b614d34dfd3a37321 Mon Sep 17 00:00:00 2001 From: BoB13-Matter Date: Wed, 18 Dec 2024 03:27:12 +0900 Subject: [PATCH] Fix Global Buffer Overflow in MediaInputManager.cpp (#36856) --- .../tv-common/clusters/media-input/MediaInputManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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());