From 83fe79d5fb783395114d70206f7f0a9adff573e4 Mon Sep 17 00:00:00 2001 From: hanlin15 Date: Thu, 31 Oct 2024 21:03:04 +0800 Subject: [PATCH] fix:IRemoteObjectTranslateWhenRcv Security Signed-off-by: hanlin15 Change-Id: I319ca5f465441de97a078abe50c088be82c4bdd1 --- ipc/native/src/mock/include/dbinder_base_invoker_object.h | 2 ++ ipc/native/src/mock/include/sys_binder.h | 1 + 2 files changed, 3 insertions(+) diff --git a/ipc/native/src/mock/include/dbinder_base_invoker_object.h b/ipc/native/src/mock/include/dbinder_base_invoker_object.h index e7874828..04d1cead 100644 --- a/ipc/native/src/mock/include/dbinder_base_invoker_object.h +++ b/ipc/native/src/mock/include/dbinder_base_invoker_object.h @@ -200,10 +200,12 @@ bool DBinderBaseInvoker::IRemoteObjectTranslateWhenRcv(char *dataBuffer, bind ZLOGE(LOG_LABEL, "fail to translate big raw data"); // do nothing } + binderObject->handle = -1; break; } default: { ZLOGE(LOG_LABEL, "do not support this type:%{public}u of translation", binderObject->hdr.type); + binderObject->hdr.type = BINDER_TYPE_INVALID_TYPE; // do nothing break; } diff --git a/ipc/native/src/mock/include/sys_binder.h b/ipc/native/src/mock/include/sys_binder.h index a5e71e4f..7e928892 100644 --- a/ipc/native/src/mock/include/sys_binder.h +++ b/ipc/native/src/mock/include/sys_binder.h @@ -282,6 +282,7 @@ enum { BINDER_TYPE_FDR = B_PACK_CHARS('f', 'd', 'r', B_TYPE_LARGE), BINDER_TYPE_INVALID_HANDLE = B_PACK_CHARS('r', 'h', 'e', B_TYPE_LARGE), BINDER_TYPE_INVALID_BINDER = B_PACK_CHARS('r', 'b', 'e', B_TYPE_LARGE), + BINDER_TYPE_INVALID_TYPE = B_PACK_CHARS('r', 't', 'e', B_TYPE_LARGE), }; struct binder_ptr_count {