From 7fb8c64b5355d97eb2e24675d566e13c0c3b0718 Mon Sep 17 00:00:00 2001 From: wanxiaoqing Date: Thu, 5 Dec 2024 22:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanxiaoqing --- framework/common/udmf_types_util.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/common/udmf_types_util.cpp b/framework/common/udmf_types_util.cpp index ad2d572..47b9aa8 100644 --- a/framework/common/udmf_types_util.cpp +++ b/framework/common/udmf_types_util.cpp @@ -43,8 +43,8 @@ template<> bool Unmarshalling(UnifiedData &output, MessageParcel &parcel) { auto size = parcel.ReadInt32(); - if (size == 0) { - LOG_ERROR(UDMF_SERVICE, "UnifiedData is empty!"); + if (size <= 0 || size > UnifiedData::MAX_DATA_SIZE) { + LOG_ERROR(UDMF_SERVICE, "UnifiedData is empty or too large!"); return false; } auto rawData = parcel.ReadRawData(size); @@ -84,8 +84,8 @@ template<> bool Unmarshalling(std::vector &output, MessageParcel &parcel) { auto size = parcel.ReadInt32(); - if (size == 0) { - LOG_ERROR(UDMF_SERVICE, "UnifiedDataSet is empty!"); + if (size <= 0 || size > UnifiedData::MAX_DATA_SIZE) { + LOG_ERROR(UDMF_SERVICE, "UnifiedDataSet is empty or too large!"); return false; } const uint8_t *rawData = reinterpret_cast(parcel.ReadRawData(size)); -- Gitee