From b0499b28cf46b3ed0c13fce231b405b78d956ba2 Mon Sep 17 00:00:00 2001 From: geyangchen Date: Tue, 28 Jun 2022 10:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=94=AF=E6=8C=91=E5=8D=95?= 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 + services/privacymanager/src/service/privacy_manager_stub.cpp | 2 +- 4 files changed, 4 insertions(+), 3 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 { diff --git a/services/privacymanager/src/service/privacy_manager_stub.cpp b/services/privacymanager/src/service/privacy_manager_stub.cpp index 0ffd1d45f..6845dd8e4 100644 --- a/services/privacymanager/src/service/privacy_manager_stub.cpp +++ b/services/privacymanager/src/service/privacy_manager_stub.cpp @@ -160,7 +160,7 @@ void PrivacyManagerStub::DumpRecordInfoInner(MessageParcel& data, MessageParcel& bool PrivacyManagerStub::IsAccessTokenCalling() const { - int callingUid = IPCSkeleton::GetCallingTokenID(); + int32_t callingUid = IPCSkeleton::GetCallingUid(); return callingUid == ACCESSTOKEN_UID; } } // namespace AccessToken -- Gitee