Skip to content

Commit

Permalink
[discovery-proxy] remove assert checks on query name parse errors
Browse files Browse the repository at this point in the history
Remove the `assert` checks on query name parse errors and instead skip
over such entries. Query names are external input (received as DNS
query message from other devices) and discovery proxy code should not
assume that external input will follow the proper query name format.
  • Loading branch information
abtink committed Feb 29, 2024
1 parent 2279c02 commit 9f87be2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sdp_proxy/discovery_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@ void DiscoveryProxy::OnServiceDiscovered(const std::string
{
case OT_DNSSD_QUERY_TYPE_BROWSE:
splitError = SplitFullServiceName(queryName, serviceName, domain);
assert(splitError == OTBR_ERROR_NONE);
break;
case OT_DNSSD_QUERY_TYPE_RESOLVE:
splitError = SplitFullServiceInstanceName(queryName, instanceName, serviceName, domain);
assert(splitError == OTBR_ERROR_NONE);
break;
default:
splitError = OTBR_ERROR_NOT_FOUND;
Expand Down Expand Up @@ -284,8 +282,13 @@ void DiscoveryProxy::OnHostDiscovered(const std::string
{
continue;
}

splitError = SplitFullHostName(queryName, hostName, domain);
assert(splitError == OTBR_ERROR_NONE);

if (splitError != OTBR_ERROR_NONE)
{
continue;
}

if (DnsLabelsEqual(hostName, aHostName))
{
Expand Down

0 comments on commit 9f87be2

Please sign in to comment.