From 2357e9a87a08170bd56cf720d90d848ee1479e61 Mon Sep 17 00:00:00 2001 From: "vimala.v" Date: Mon, 28 Mar 2016 16:06:21 +0530 Subject: [PATCH] Fix for crash in Tizen casample when message type is CA_MSG_RESET Change-Id: I94937968bb6e63c74d0458919cdfedce1b2b60b0 Signed-off-by: vimala.v Reviewed-on: https://gerrit.iotivity.org/gerrit/7397 Reviewed-by: Abhishek Sharma Tested-by: jenkins-iotivity Reviewed-by: Ashok Babu Channa --- resource/csdk/connectivity/samples/tizen/casample.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resource/csdk/connectivity/samples/tizen/casample.c b/resource/csdk/connectivity/samples/tizen/casample.c index 7e0810f0f..2d2a594df 100644 --- a/resource/csdk/connectivity/samples/tizen/casample.c +++ b/resource/csdk/connectivity/samples/tizen/casample.c @@ -1169,7 +1169,13 @@ void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info) responseData.messageId = (info != NULL) ? info->messageId : 0; responseData.resourceUri = (info != NULL) ? info->resourceUri : 0; - if(CA_MSG_RESET != messageType) + if (CA_MSG_RESET == messageType || + (CA_MSG_ACKNOWLEDGE == messageType && CA_EMPTY == responseCode)) + { + printf("RESET or ACK/EMPTY. there will be not payload/option\n"); + + } + else { responseData.token = (info != NULL) ? info->token : NULL; responseData.tokenLength = (info != NULL) ? info->tokenLength : 0; @@ -1217,8 +1223,8 @@ void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info) (const char *) responseData.resourceUri); } } + responseData.payloadSize = strlen((char *)responseData.payload)+1; } - responseData.payloadSize = strlen((char *)responseData.payload)+1; CAResponseInfo_t responseInfo = { 0 }; responseInfo.result = responseCode; responseInfo.info = responseData; -- 2.34.1