diff --git a/src/core/net/srp_advertising_proxy.cpp b/src/core/net/srp_advertising_proxy.cpp index b40abf408..f75d9ca70 100644 --- a/src/core/net/srp_advertising_proxy.cpp +++ b/src/core/net/srp_advertising_proxy.cpp @@ -1152,7 +1152,10 @@ void AdvertisingProxy::UnregisterKey(const char *aName, const char *aServiceType void AdvertisingProxy::CopyNameAndRemoveDomain(DnsName &aName, const char *aFullName) { - IgnoreError(Dns::Name::ExtractLabels(aFullName, Get().GetDomain(), aName, sizeof(aName))); + if (Dns::Name::ExtractLabels(aFullName, Get().GetDomain(), aName, sizeof(aName)) != kErrorNone) + { + aName[0] = kNullChar; + } } void AdvertisingProxy::HandleRegistered(otInstance *aInstance, otPlatDnssdRequestId aRequestId, otError aError)