From 727a2b7685a6f56feae936f4afc710673d336750 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:56:50 -0700 Subject: [PATCH] Cherry pick PR #4091: Specify string size to prevent heap-buffer-overflow. (#4094) Refer to the original PR: https://github.com/youtube/cobalt/pull/4091 b/363029201 Co-authored-by: aee --- starboard/loader_app/slot_management.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/starboard/loader_app/slot_management.cc b/starboard/loader_app/slot_management.cc index 4900cfd52c8..842a702bc23 100644 --- a/starboard/loader_app/slot_management.cc +++ b/starboard/loader_app/slot_management.cc @@ -140,7 +140,8 @@ bool ReadEvergreenVersion(std::vector* manifest_file_path, Json::Reader reader; Json::Value obj; - if (!reader.parse(std::string(file_data.data()), obj) || !obj[kVersionKey]) { + if (!reader.parse(std::string(file_data.data(), file_size), obj) || + !obj[kVersionKey]) { SB_LOG(WARNING) << "Failed to parse version from the manifest file at the " "installation path."; return false;