From 0edbf1eb597784bcf3e6eb4df421f46e1f1e7a43 Mon Sep 17 00:00:00 2001 From: geyangchen Date: Tue, 28 Jun 2022 10:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: geyangchen --- frameworks/accesstoken/src/hap_token_info_for_sync_parcel.cpp | 2 +- .../accesstoken/src/native_token_info_for_sync_parcel.cpp | 2 +- frameworks/common/include/parcel_utils.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/accesstoken/src/hap_token_info_for_sync_parcel.cpp b/frameworks/accesstoken/src/hap_token_info_for_sync_parcel.cpp index 89766e871..769bf4046 100644 --- a/frameworks/accesstoken/src/hap_token_info_for_sync_parcel.cpp +++ b/frameworks/accesstoken/src/hap_token_info_for_sync_parcel.cpp @@ -30,7 +30,7 @@ bool HapTokenInfoForSyncParcel::Marshalling(Parcel& out) const const std::vector& permStateList = this->hapTokenInfoForSyncParams.permStateList; int32_t permStateListSize = static_cast(permStateList.size()); RETURN_IF_FALSE(out.WriteInt32(permStateListSize)); - + RETURN_IF_FALSE((permStateListSize <= MAX_PERMLIST_SIZE)); for (int i = 0; i < permStateListSize; i++) { PermissionStateFullParcel permStateParcel; permStateParcel.permStatFull = permStateList[i]; diff --git a/frameworks/accesstoken/src/native_token_info_for_sync_parcel.cpp b/frameworks/accesstoken/src/native_token_info_for_sync_parcel.cpp index 541bbea1d..cfbddc9f7 100644 --- a/frameworks/accesstoken/src/native_token_info_for_sync_parcel.cpp +++ b/frameworks/accesstoken/src/native_token_info_for_sync_parcel.cpp @@ -30,7 +30,7 @@ bool NativeTokenInfoForSyncParcel::Marshalling(Parcel& out) const const std::vector& permStateList = this->nativeTokenInfoForSyncParams.permStateList; int32_t permStateListSize = static_cast(permStateList.size()); RETURN_IF_FALSE(out.WriteInt32(permStateListSize)); - + RETURN_IF_FALSE((permStateListSize <= MAX_PERMLIST_SIZE)); for (int i = 0; i < permStateListSize; i++) { PermissionStateFullParcel permStateParcel; permStateParcel.permStatFull = permStateList[i]; diff --git a/frameworks/common/include/parcel_utils.h b/frameworks/common/include/parcel_utils.h index ddc87d688..d6b7e8b6b 100644 --- a/frameworks/common/include/parcel_utils.h +++ b/frameworks/common/include/parcel_utils.h @@ -15,6 +15,7 @@ #ifndef PARCEL_UTILS_H #define PARCEL_UTILS_H +#define MAX_PERMLIST_SIZE 256 namespace OHOS { namespace Security { namespace AccessToken { -- Gitee