- fixed bug in server side delete-data-set service. Server crashes when client sends an unknown LD/domain name

This commit is contained in:
Michael Zillgith 2015-02-19 17:57:33 +01:00
parent 1700bca56b
commit 4cc0b4fe13
2 changed files with 17 additions and 9 deletions

View file

@ -80,6 +80,9 @@ MmsDomain_getNamedVariableList(MmsDomain* self, char* variableListName)
{
MmsNamedVariableList variableList = NULL;
if (self == NULL)
goto exit_function;
LinkedList element = LinkedList_getNext(self->namedVariableLists);
while (element != NULL) {
@ -93,6 +96,8 @@ MmsDomain_getNamedVariableList(MmsDomain* self, char* variableListName)
element = LinkedList_getNext(element);
}
exit_function:
return variableList;
}

View file

@ -141,19 +141,22 @@ mmsServer_handleDeleteNamedVariableListRequest(MmsServerConnection connection,
MmsDomain* domain = MmsDevice_getDomain(device, domainName);
MmsNamedVariableList variableList = MmsDomain_getNamedVariableList(domain, listName);
if (domain != NULL) {
if (variableList != NULL) {
numberMatched++;
MmsNamedVariableList variableList = MmsDomain_getNamedVariableList(domain, listName);
if (MmsNamedVariableList_isDeletable(variableList)) {
if (variableList != NULL) {
numberMatched++;
if (mmsServer_callVariableListChangedHandler(false, MMS_DOMAIN_SPECIFIC, domain, listName, connection) == true) {
MmsDomain_deleteNamedVariableList(domain, listName);
numberDeleted++;
if (MmsNamedVariableList_isDeletable(variableList)) {
if (mmsServer_callVariableListChangedHandler(false, MMS_DOMAIN_SPECIFIC, domain, listName, connection) == true) {
MmsDomain_deleteNamedVariableList(domain, listName);
numberDeleted++;
}
}
}
}
}
}
}
else if (request->listOfVariableListName->list.array[i]->present == ObjectName_PR_aaspecific) {
char listName[65];