Add NULL dereference checks
This commit is contained in:
Родитель
4176ab9a9e
Коммит
19d3a7b9e3
|
@ -54,7 +54,15 @@ static bool find_item_by_message_ptr(LIST_ITEM_HANDLE list_item, const void* mat
|
|||
MESSAGE_QUEUE_ITEM* current_item = (MESSAGE_QUEUE_ITEM*)singlylinkedlist_item_get_value(list_item);
|
||||
MQ_MESSAGE_HANDLE* target_item = (MQ_MESSAGE_HANDLE*)match_context;
|
||||
|
||||
return (current_item->message == target_item);
|
||||
if (current_item == NULL)
|
||||
{
|
||||
LogError("Failed finding item: current_item is NULL");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (current_item->message == target_item);
|
||||
}
|
||||
}
|
||||
|
||||
static void fire_message_callback(MESSAGE_QUEUE_ITEM* mq_item, MESSAGE_QUEUE_RESULT result, void* reason)
|
||||
|
|
|
@ -560,6 +560,12 @@ EXECUTE_COMMAND_RESULT CodeFirst_InvokeAction(DEVICE_HANDLE deviceHandle, void*
|
|||
result = EXECUTE_COMMAND_ERROR;
|
||||
LogError("parameterValues error %s ", MU_ENUM_TO_STRING(EXECUTE_COMMAND_RESULT, result));
|
||||
}
|
||||
/*Codes_SRS_CODEFIRST_99_200:[ If devicHeader (callbackUserContext) is NULL then EXECUTE_COMMAND_ERROR shall be returned.]*/
|
||||
else if (deviceHeader == NULL)
|
||||
{
|
||||
result = EXECUTE_COMMAND_ERROR;
|
||||
LogError("callback User Context error %s ", MU_ENUM_TO_STRING(EXECUTE_COMMAND_RESULT, result));
|
||||
}
|
||||
else
|
||||
{
|
||||
const REFLECTED_SOMETHING* something;
|
||||
|
@ -630,6 +636,11 @@ METHODRETURN_HANDLE CodeFirst_InvokeMethod(DEVICE_HANDLE deviceHandle, void* cal
|
|||
result = NULL;
|
||||
LogError("parameterValues error ");
|
||||
}
|
||||
else if (deviceHeader == NULL)
|
||||
{
|
||||
result = NULL;
|
||||
LogError("callback User Context error ");
|
||||
}
|
||||
else
|
||||
{
|
||||
const REFLECTED_SOMETHING* something;
|
||||
|
|
Загрузка…
Ссылка в новой задаче