From: Lohit Agarwalla Date: Fri, 6 Aug 2021 07:30:23 +0000 (+0530) Subject: Null check for strtok_r X-Git-Tag: submit/tizen/20210809.071123^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F262305%2F2;p=platform%2Fcore%2Fapi%2Flibaccount-service.git Null check for strtok_r Change-Id: Id4349444446f10c28cc1eb6135bd7f4e616a33a0 Signed-off-by: Lohit Agarwalla --- diff --git a/src/account.c b/src/account.c index 081cf88..6ff7aa0 100644 --- a/src/account.c +++ b/src/account.c @@ -2956,7 +2956,16 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data) char *ptr = NULL; event_type = strtok_r(msg, ":", &ptr); + if (event_type == NULL) { + ACCOUNT_ERROR("strtok_r() failed"); + goto END; + } + id = strtok_r(NULL, ":", &ptr); + if (id == NULL) { + ACCOUNT_ERROR("strtok_r() failed"); + goto END; + } ACCOUNT_SLOGD("msg(%s), event_type(%s), id(%s)", msg, event_type, id); @@ -2967,6 +2976,7 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data) if (tmp->account_subscription_callback) tmp->account_subscription_callback(event_msg, account_id, tmp->user_data); +END: _ACCOUNT_FREE(msg); } }