Skip to content

Commit

Permalink
Merge pull request #253 from vathikar/master
Browse files Browse the repository at this point in the history
Added NULL check for MAC
  • Loading branch information
shilpa24balaji committed Nov 12, 2018
2 parents 2f762fe + 8a69bc3 commit 9aa18ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/upstream.c
Expand Up @@ -198,6 +198,7 @@ void *processUpstreamMessage()
int matchFlag = 0;
int status = -1;
char *serviceName = NULL;
char *macId = NULL;
char *destService, *destApplication =NULL;
char *sourceService, *sourceApplication =NULL;
int sendStatus =-1;
Expand Down Expand Up @@ -335,6 +336,7 @@ void *processUpstreamMessage()
ParodusInfo(" Received upstream data with MsgType: %d dest: '%s' transaction_uuid: %s status: %d\n",msgType, msg->u.crud.dest, msg->u.crud.transaction_uuid, msg->u.crud.status );
if(WRP_MSG_TYPE__RETREIVE == msgType && msg->u.crud.dest !=NULL && msg->u.crud.source != NULL)
{
macId = wrp_get_msg_element(WRP_ID_ELEMENT__ID, msg, DEST);
destService = wrp_get_msg_element(WRP_ID_ELEMENT__SERVICE, msg, DEST);
destApplication = wrp_get_msg_element(WRP_ID_ELEMENT__APPLICATION, msg, DEST);
sourceService = wrp_get_msg_element(WRP_ID_ELEMENT__SERVICE, msg, SOURCE);
Expand All @@ -343,7 +345,7 @@ void *processUpstreamMessage()
Expecting dest format as mac:xxxxxxxxxxxx/parodus/cloud-status
Parse dest field and check destService is "parodus" and destApplication is "cloud-status"
*/
if(destService != NULL && destApplication != NULL && strcmp(destService,"parodus")== 0 && strcmp(destApplication,"cloud-status")== 0)
if(macId != NULL && destService != NULL && destApplication != NULL && strcmp(destService,"parodus")== 0 && strcmp(destApplication,"cloud-status")== 0)
{
retrieve_msg = ( wrp_msg_t *)malloc( sizeof( wrp_msg_t ) );
memset(retrieve_msg, 0, sizeof(wrp_msg_t));
Expand Down

0 comments on commit 9aa18ce

Please sign in to comment.