From 48abf12e00bc36f403ef7c016c771aea196ae40f Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 11 May 2023 19:37:13 -0700 Subject: [PATCH] [dns-client] check all responses in `GetHostAddress()` (#9044) This commit fixes an issue with `ServiceResponse::GetHostAddress()` method. The issue only occurs when separate queries (e.g., for SRV and TXT records) are used, and therefore separate `Response` objects are collected and chained together as a linked list. The change ensures that we check every response in the list when getting host addresses. --- src/core/net/dns_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/net/dns_client.cpp b/src/core/net/dns_client.cpp index 3e14fb3ed..da1672535 100644 --- a/src/core/net/dns_client.cpp +++ b/src/core/net/dns_client.cpp @@ -639,7 +639,7 @@ Error Client::ServiceResponse::GetHostAddress(const char *aHostName, for (const Response *response = this; response != nullptr; response = response->mNext) { - error = FindHostAddress(kAdditionalDataSection, Name(aHostName), aIndex, aAddress, aTtl); + error = response->FindHostAddress(kAdditionalDataSection, Name(aHostName), aIndex, aAddress, aTtl); if (error == kErrorNone) {