From a201336bf90504ab48130ea0344690d6d803d1ea Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 11 May 2023 21:27:19 +0000 Subject: Fix the Nullable pointer is dereferenced issue The member ai_addr is allowed to be null, which will cause dereferencing nullptr issue here. See https://android-build.corp.google.com/artifact/pending/P54712024/aosp_arm64-userdebug/latest/view/logs%2Fbuild.log for more details Bug: None Test: mm Change-Id: Ie1e8ec56bbd1edee0456c26d0d29775bc7abbbb5 --- libs/binder/RpcServer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'libs/binder/RpcServer.cpp') diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp index 9282856f5c..84131a51bc 100644 --- a/libs/binder/RpcServer.cpp +++ b/libs/binder/RpcServer.cpp @@ -81,6 +81,7 @@ status_t RpcServer::setupInetServer(const char* address, unsigned int port, auto aiStart = InetSocketAddress::getAddrInfo(address, port); if (aiStart == nullptr) return UNKNOWN_ERROR; for (auto ai = aiStart.get(); ai != nullptr; ai = ai->ai_next) { + if (ai->ai_addr == nullptr) continue; InetSocketAddress socketAddress(ai->ai_addr, ai->ai_addrlen, address, port); if (status_t status = setupSocketServer(socketAddress); status != OK) { continue; -- cgit v1.2.3-59-g8ed1b