Skip to content

Commit

Permalink
check the error failures #2
Browse files Browse the repository at this point in the history
  • Loading branch information
abtink committed Sep 3, 2023
1 parent 5c2f6e3 commit adc2739
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mdns/mdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ otbrError Publisher::DecodeTxtData(Publisher::TxtList &aTxtList, const uint8_t *

if (keyEnd == entryEnd)
{
if (keyEnd > keyStart)
//if (keyEnd > keyStart) // CAUSE FAILURE
{
// No `=`, treat as a boolean attribute.
aTxtList.emplace_back(reinterpret_cast<const char *>(&aTxtData[keyStart]), keyEnd - keyStart);
Expand Down
22 changes: 20 additions & 2 deletions src/sdp_proxy/advertising_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,16 @@ otbrError AdvertisingProxy::PublishHostAndItsServices(const otSrpServerHost *aHo
const otSrpServerService *service;
otSrpServerServiceUpdateId updateId = 0;
bool hasUpdate = false;
std::string fullHostName = otSrpServerHostGetFullName(aHost);
std::string fullHostName;

if (otSrpServerHostGetFullName(aHost) == nullptr)
{
otbrLogWarning("ABTIN ~~~ otSrpServerHostGetFullName() is null WHY?");
error = OTBR_ERROR_INVALID_ARGS;
ExitNow();
}

fullHostName = otSrpServerHostGetFullName(aHost);

otbrLogInfo("Advertise SRP service updates: host=%s", fullHostName.c_str());

Expand All @@ -256,11 +265,20 @@ otbrError AdvertisingProxy::PublishHostAndItsServices(const otSrpServerHost *aHo
service = nullptr;
while ((service = otSrpServerHostGetNextService(aHost, service)) != nullptr)
{
std::string fullServiceName = otSrpServerServiceGetInstanceName(service);
std::string fullServiceName;
std::string serviceName;
std::string serviceType;
std::string serviceDomain;

if (otSrpServerServiceGetInstanceName(service) == nullptr)
{
otbrLogWarning("ABTIN ~~~ otSrpServerServiceGetInstanceName() is null WHY?");
error = OTBR_ERROR_INVALID_ARGS;
ExitNow();
}

fullServiceName = otSrpServerServiceGetInstanceName(service);

SuccessOrExit(error = SplitFullServiceInstanceName(fullServiceName, serviceName, serviceType, serviceDomain));

if (!hostDeleted && !otSrpServerServiceIsDeleted(service))
Expand Down

0 comments on commit adc2739

Please sign in to comment.