mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[srp-server] update validation of instance and service names (#8080)
This commit updates `ProcessServiceDiscoveryInstructions()` method to use `Dns::Name::IsSubDomainOf()` to validate the relation between service instance name and the base service name.
This commit is contained in:
committed by
GitHub
parent
d72c10eed3
commit
958eb5c5bf
@@ -931,10 +931,8 @@ Error Server::ProcessServiceDiscoveryInstructions(Host & aHost,
|
||||
}
|
||||
|
||||
// Verify that instance name and service name are related.
|
||||
|
||||
VerifyOrExit(
|
||||
StringEndsWith(instanceName, isSubType ? subServiceName : serviceName, kStringCaseInsensitiveMatch),
|
||||
error = kErrorFailed);
|
||||
VerifyOrExit(Dns::Name::IsSubDomainOf(instanceName, isSubType ? subServiceName : serviceName),
|
||||
error = kErrorFailed);
|
||||
|
||||
// Ensure the same service does not exist already.
|
||||
VerifyOrExit(aHost.FindService(serviceName, instanceName) == nullptr, error = kErrorFailed);
|
||||
|
||||
Reference in New Issue
Block a user