From d7b94e61bbbaf54bea4cd0c20840cc7c13e75e54 Mon Sep 17 00:00:00 2001 From: liqiao49 Date: Thu, 13 Jul 2023 09:47:27 +0800 Subject: [PATCH] fix null pointer is not verified Signed-off-by: liqiao49 --- interfaces/ipc/src/distributed_input_sink_stub.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 306f6e4..04b77e3 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -138,6 +138,10 @@ int32_t DistributedInputSinkStub::NotifyStopDScreenInner(MessageParcel &data, Me int32_t DistributedInputSinkStub::RegisterSharingDhIdListenerInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { + if (data.ReadRemoteObject() == nullptr) { + DHLOGE("RegisterSharingDhIdListenerInner failed, data.ReadRemoteObject is nullptr."); + return ERR_DH_INPUT_SINK_STUB_REGISTER_SHARING_DHID_LISTENER_FAIL; + } sptr listener = iface_cast(data.ReadRemoteObject()); int32_t ret = RegisterSharingDhIdListener(listener); if (!reply.WriteInt32(ret)) {