From 1eb417e8df5199258fc7c0c279a2182c17e45481 Mon Sep 17 00:00:00 2001 From: "kush.agrawal@samsung.com" Date: Fri, 22 Jun 2018 23:00:08 +0900 Subject: [PATCH] Crash in OCProcessPresence (#298) * [CONPRO-1285]Crash in OCProcessPresence There is a issue after freeing the clientcb we are again accessing it.It can possibly crash. So, to avoid this scenario we are using LL_FOREACH_SAFE to iterate the list Signed-off-by: agrkush * Update ocstack.c https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/298 (cherry picked from commit 578c6918d40d5bded028266ceb3a4aaf68d33623) Change-Id: Id514a242e34d7a20df2845c09a757b3d26c9604a Signed-off-by: Amit KS --- resource/csdk/stack/src/ocstack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 resource/csdk/stack/src/ocstack.c diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c old mode 100644 new mode 100755 index 60e8e29..f469c51 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -3338,10 +3338,11 @@ OCStackResult OCProcessPresence() // to most purposes. Uncomment as needed. //OIC_LOG(INFO, TAG, "Entering RequestPresence"); ClientCB* cbNode = NULL; + ClientCB* tempcbNode = NULL; OCClientResponse clientResponse; OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION; - LL_FOREACH(cbList, cbNode) + LL_FOREACH_SAFE(cbList, cbNode, tempcbNode) { if (OC_REST_PRESENCE != cbNode->method || !cbNode->presence) { -- 2.7.4