From: George Nash Date: Fri, 9 Dec 2016 17:55:59 +0000 (-0800) Subject: Fix possible NULL pointer dereference X-Git-Tag: 1.3.0~971 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44ae91b328fbc081d28aa7aaff020990d6d6948f;p=platform%2Fupstream%2Fiotivity.git Fix possible NULL pointer dereference if *userdata was a NULL pointer it would be dereferenced it even after a NULL pointer check. The dereference was moved inside the NULL pointer check to prevent the pointer dereference. Change-Id: I334d56c210e81329bcfef9936fbe653cc5561e8f Signed-off-by: George Nash Reviewed-on: https://gerrit.iotivity.org/gerrit/15371 Tested-by: jenkins-iotivity Reviewed-by: Jihun Ha Reviewed-by: JungYong KIM Reviewed-by: Habib Virji Reviewed-by: Uze Choi --- diff --git a/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c b/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c index aaa351b..5a1f29a 100755 --- a/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c +++ b/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c @@ -56,10 +56,10 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata) if(*userdata != NULL) { *userdata = (void*)OICMalloc(sizeof(UserProperties)); + ((UserProperties*)(*userdata))->userValue_int = value; } OIC_LOG_V(INFO, ESX_ENROLLEE_TAG, "[User specific property] %s : %ld", USERPROPERTY_KEY_INT, value); - ((UserProperties*)(*userdata))->userValue_int = value; g_userProperties.userValue_int = value; } }