Description:fix security bug
Sig: SIG_ApplicationFramework
Feature or Bugfix:Bugfix
Binary Source:No

Signed-off-by: liqiang <liqiang121@huawei.com>
Change-Id: Ie85a746649154b02f9906b4e3cccff222734b172
This commit is contained in:
liqiang
2022-03-17 09:41:39 +08:00
parent cd1b09d51d
commit c2dac565e1
2 changed files with 11 additions and 11 deletions
+5 -5
View File
@@ -54,7 +54,7 @@ bool CommonEventProxy::PublishCommonEvent(const CommonEventData &event, const Co
return false;
}
if (!data.WriteParcelable(commonEventListener)) {
if (!data.WriteRemoteObject(commonEventListener)) {
EVENT_LOGE("Failed to write parcelable commonEventListener");
return false;
}
@@ -96,7 +96,7 @@ bool CommonEventProxy::PublishCommonEvent(const CommonEventData &event, const Co
return false;
}
if (!data.WriteParcelable(commonEventListener)) {
if (!data.WriteRemoteObject(commonEventListener)) {
EVENT_LOGE("Failed to write parcelable commonEventListener");
return false;
}
@@ -137,7 +137,7 @@ bool CommonEventProxy::SubscribeCommonEvent(
EVENT_LOGE("Failed to write parcelable subscribeInfo");
return false;
}
if (!data.WriteParcelable(commonEventListener)) {
if (!data.WriteRemoteObject(commonEventListener)) {
EVENT_LOGE("Failed to write parcelable commonEventListener");
return false;
}
@@ -163,7 +163,7 @@ bool CommonEventProxy::UnsubscribeCommonEvent(const sptr<IRemoteObject> &commonE
return false;
}
if (!data.WriteParcelable(commonEventListener)) {
if (!data.WriteRemoteObject(commonEventListener)) {
EVENT_LOGE("Failed to write parcelable commonEventListener");
return false;
}
@@ -255,7 +255,7 @@ bool CommonEventProxy::FinishReceiver(
return false;
}
if (!data.WriteParcelable(proxy)) {
if (!data.WriteRemoteObject(proxy)) {
EVENT_LOGE("Failed to write parcelable proxy");
return false;
}
+6 -6
View File
@@ -37,7 +37,7 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
case static_cast<uint32_t>(ICommonEvent::Message::CES_PUBLISH_COMMON_EVENT): {
std::unique_ptr<CommonEventData> event(data.ReadParcelable<CommonEventData>());
std::unique_ptr<CommonEventPublishInfo> publishinfo(data.ReadParcelable<CommonEventPublishInfo>());
sptr<IRemoteObject> commonEventListener = data.ReadParcelable<IRemoteObject>();
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
int32_t userId = data.ReadInt32();
if (!event) {
EVENT_LOGE("Failed to ReadParcelable<CommonEventData>");
@@ -58,7 +58,7 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
case static_cast<uint32_t>(ICommonEvent::Message::CES_PUBLISH_COMMON_EVENT2): {
std::unique_ptr<CommonEventData> event(data.ReadParcelable<CommonEventData>());
std::unique_ptr<CommonEventPublishInfo> publishinfo(data.ReadParcelable<CommonEventPublishInfo>());
sptr<IRemoteObject> commonEventListener = data.ReadParcelable<IRemoteObject>();
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
int uid = data.ReadInt32();
int32_t userId = data.ReadInt32();
if (!event) {
@@ -79,7 +79,7 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
case static_cast<uint32_t>(ICommonEvent::Message::CES_SUBSCRIBE_COMMON_EVENT): {
std::unique_ptr<CommonEventSubscribeInfo> subscribeInfo(data.ReadParcelable<CommonEventSubscribeInfo>());
sptr<IRemoteObject> commonEventListener = data.ReadParcelable<IRemoteObject>();
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
if (!subscribeInfo) {
EVENT_LOGE("Failed to ReadParcelable<CommonEventSubscribeInfo>");
return ERR_INVALID_VALUE;
@@ -97,7 +97,7 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
}
case static_cast<uint32_t>(ICommonEvent::Message::CES_UNSUBSCRIBE_COMMON_EVENT): {
sptr<IRemoteObject> commonEventListener = data.ReadParcelable<IRemoteObject>();
sptr<IRemoteObject> commonEventListener = data.ReadRemoteObject();
if (commonEventListener == nullptr) {
EVENT_LOGE("Failed to ReadParcelable<IRemoteObject>");
return ERR_INVALID_VALUE;
@@ -138,9 +138,9 @@ int CommonEventStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
}
case static_cast<uint32_t>(ICommonEvent::Message::CES_FINISH_RECEIVER): {
sptr<IRemoteObject> proxy = data.ReadParcelable<IRemoteObject>();
sptr<IRemoteObject> proxy = data.ReadRemoteObject();
if (proxy == nullptr) {
EVENT_LOGE("Failed to ReadParcelable<IRemoteObject>");
EVENT_LOGE("Failed to ReadRemoteObject");
return ERR_INVALID_VALUE;
}
int receiverCode = data.ReadInt32();