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

Commit 3f1b552d authored by Hungming Chen's avatar Hungming Chen Committed by Nucca Chen
Browse files

dns_responder: Return an error if failed to build a resource record

If failed to build an expected RDATA resource record, the DNS
responder should not add the empty resource record into the answer
section of DNS response message.

Test: built, flashed, booted
      system/netd/tests/runtests.sh passes

Change-Id: I0d786f05142e9065c53266b9be79b86423b6919d
parent ef1fcb6f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -821,7 +821,7 @@ bool DNSResponder::addAnswerRecords(const DNSQuestion& question,
                    .rclass = ns_class::ns_c_in,
                    .ttl = 5,  // seconds
            };
            fillAnswerRdata(it->second, record);
            if (!fillAnswerRdata(it->second, record)) return false;
            answers->push_back(std::move(record));
            if (rtype != ns_type::ns_t_cname) break;
            rname = it->second;