From 3179dfc399c26ec1327de330b25646b565cc6d8c Mon Sep 17 00:00:00 2001 From: wbq_sky Date: Sat, 12 Mar 2022 18:39:30 +0800 Subject: [PATCH] add the limit for opinions Signed-off-by: wbq_sky --- .../libs/distributeddb/common/src/schema_negotiate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/distributeddataservice/libs/distributeddb/common/src/schema_negotiate.cpp b/services/distributeddataservice/libs/distributeddb/common/src/schema_negotiate.cpp index 3bd78a2e4..c6b147c6b 100644 --- a/services/distributeddataservice/libs/distributeddb/common/src/schema_negotiate.cpp +++ b/services/distributeddataservice/libs/distributeddb/common/src/schema_negotiate.cpp @@ -225,6 +225,10 @@ int SchemaNegotiate::DeserializeData(Parcel &parcel, RelationalSyncOpinion &opin uint32_t opinionSize; (void)parcel.ReadUInt32(opinionSize); (void)parcel.EightByteAlign(); + static const uint32_t MAX_OPINION_SIZE = 1024; // max 1024 opinions + if (parcel.IsError() || opinionSize > MAX_OPINION_SIZE) { + return -E_INVALID_ARGS; + } for (uint32_t i = 0; i < opinionSize; i++) { std::string tableName; SyncOpinion tableOpinion; -- Gitee