Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a201336b authored by zijunzhao's avatar zijunzhao Committed by Zijun Zhao
Browse files

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
parent 3265d955
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;