From 17f0cdcdf543748dbe15a631ef869d1a5638e41d Mon Sep 17 00:00:00 2001 From: Vishal Thanki Date: Thu, 2 Apr 2020 13:32:45 +0200 Subject: [PATCH] Fix client validation in LifecycleRequestComplete The client is validated by comparing the client handle and request ID received as a part of D-Bus call LifecycleRequestComplete. The reqeust ID is generated by converting the client handle to guint, which is 32 bit unsigned int. The client handle is a pointer which can be of 64 bits in size on 64 bit machine. The existing comparison between client handle and request ID is casting request ID to a pointer type, which can give wrong results when comparting against a 64 bit pointer. This patch fixes it by modifying the comparision to cast the client handle to 32 bit instead. Signed-off-by: Vishal Thanki --- NodeStateAccess/NodeStateAccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NodeStateAccess/NodeStateAccess.c b/NodeStateAccess/NodeStateAccess.c index c167247..d9d96e2 100644 --- a/NodeStateAccess/NodeStateAccess.c +++ b/NodeStateAccess/NodeStateAccess.c @@ -844,7 +844,7 @@ static gboolean NSMA__boOnHandleLifecycleRequestComplete(NodeStateConsumer * NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet; /* Check if the client is the one, we are waiting for. */ - if(NSMA__pCurrentLcConsumer == (NodeStateLifeCycleConsumer*) u32RequestId) + if(u32RequestId == (guint) NSMA__pCurrentLcConsumer) { enErrorStatus = NsmErrorStatus_Ok; /* The client is the expected one. Pass the status to the NSM. */