commit | a201336bf90504ab48130ea0344690d6d803d1ea | [log] [tgz] |
---|---|---|
author | zijunzhao <zijunzhao@google.com> | Thu May 11 21:27:19 2023 +0000 |
committer | Zijun Zhao <zijunzhao@google.com> | Thu May 11 21:31:47 2023 +0000 |
tree | 6b9b5a4bf916671a285de74643c2c74a467947e9 | |
parent | 3265d9555a0f295c1620197a59dcc550fec70908 [diff] [blame] |
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
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp index 9282856..84131a5 100644 --- a/libs/binder/RpcServer.cpp +++ b/libs/binder/RpcServer.cpp
@@ -81,6 +81,7 @@ 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;