diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index 3d8562e144c20a..a1b28b726614f9 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -96,15 +96,14 @@ static void HandleNodeBrowse(void * context, DnssdService * services, size_t ser auto & ipAddress = services[i].mAddress; // mType(service name) exactly matches with operational service name - bool isOperationalBrowse = (strncmp(services[i].mType, kOperationalServiceName, sizeof(services[i].mType)) == 0 && - strlen(services[i].mType) == strlen(kOperationalServiceName)); + bool isOperationalBrowse = strcmp(services[i].mType, kOperationalServiceName) == 0; // For operational browse result we currently don't need IP address hence skip resolution and handle differently. if (isOperationalBrowse) { HandleNodeOperationalBrowse(context, &services[i], error); } - // if SRV, TXT and AAAA records were received in DNS responses + // check whether SRV, TXT and AAAA records were received in DNS responses else if (strlen(services[i].mHostName) == 0 || services[i].mTextEntrySize == 0 || !ipAddress.has_value()) { ChipDnssdResolve(&services[i], services[i].mInterface, HandleNodeResolve, context); diff --git a/src/platform/Darwin/DnssdContexts.cpp b/src/platform/Darwin/DnssdContexts.cpp index 1e79726e673cbd..0e06e0851f28d3 100644 --- a/src/platform/Darwin/DnssdContexts.cpp +++ b/src/platform/Darwin/DnssdContexts.cpp @@ -609,8 +609,7 @@ bool ResolveContext::TryReportingResultsForInterfaceIndex(uint32_t interfaceInde DiscoveredNodeData nodeData; // mType(service name) exactly matches with operational service name - if (strncmp(services[i].mType, kOperationalServiceName, sizeof(services[i].mType)) == 0 && - strlen(services[i].mType) == strlen(kOperationalServiceName)) + if (strncmp(service[i].mType, kOperationalServiceName) == 0) { service.ToDiscoveredOperationalNodeBrowseData(nodeData); }