From 945e926c4f167d481c76a1c3d3b001195f8b8ef3 Mon Sep 17 00:00:00 2001 From: jialinbo Date: Sat, 26 Oct 2024 03:13:49 +0000 Subject: [PATCH] fix: function stoi() check input parameter Signed-off-by: jialinbo --- .../src/mock/source/dbinder_databus_invoker.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ipc/native/src/mock/source/dbinder_databus_invoker.cpp b/ipc/native/src/mock/source/dbinder_databus_invoker.cpp index 81b0b1b5..3e385050 100644 --- a/ipc/native/src/mock/source/dbinder_databus_invoker.cpp +++ b/ipc/native/src/mock/source/dbinder_databus_invoker.cpp @@ -556,12 +556,6 @@ bool DBinderDatabusInvoker::UpdateClientSession(std::shared_ptrCreateClientSocket(ownName, - sessionObject->GetServiceName(), sessionObject->GetDeviceId()); - if (socketId <= 0) { - ZLOGE(LOG_LABEL, "fail to creat client Socket"); - return false; - } std::string serviceName = sessionObject->GetServiceName(); std::string str = serviceName.substr(DBINDER_SOCKET_NAME_PREFIX.length()); std::string::size_type pos = str.find("_"); @@ -572,6 +566,11 @@ bool DBinderDatabusInvoker::UpdateClientSession(std::shared_ptrCreateClientSocket(ownName, serviceName, sessionObject->GetDeviceId()); + if (socketId <= 0) { + ZLOGE(LOG_LABEL, "fail to creat client Socket"); + return false; + } sessionObject->SetSocketId(socketId); sessionObject->SetPeerPid(std::stoi(peerPid)); sessionObject->SetPeerUid(std::stoi(peerUid)); -- Gitee