From: Seungha Son Date: Fri, 26 Jan 2018 01:07:54 +0000 (+0900) Subject: Fix null dereference X-Git-Tag: submit/tizen/20180305.044310~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38845abe74f06408e4b1971593b574670454b82b;p=platform%2Fcore%2Fapi%2Fnotification.git Fix null dereference If app_id is null and length of 'app_id' is 0 and type is 'NOTIFICATION_TYPE_NONE', query_where variable is dereference null. Signed-off-by: Seungha Son Change-Id: I414e27fdd0731104cae1ffea85e02ee12a191a45 --- diff --git a/src/notification_noti.c b/src/notification_noti.c index 9d964ae1..a799fb1c 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -1224,15 +1224,15 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, } if (app_id == NULL || strlen(app_id) == 0) { - if (type != NOTIFICATION_TYPE_NONE) { - query_where = sqlite3_mprintf("WHERE type = %d " - "AND uid = %d", type, uid); - if (query_where == NULL) { - /* LCOV_EXCL_START */ - ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; - goto err; - /* LCOV_EXCL_STOP */ - } + if (type == NOTIFICATION_TYPE_NONE) + query_where = sqlite3_mprintf("WHERE uid = %d", uid); + else + query_where = sqlite3_mprintf("WHERE type = %d AND uid = %d", type, uid); + if (query_where == NULL) { + /* LCOV_EXCL_START */ + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + /* LCOV_EXCL_STOP */ } } else { if (type == NOTIFICATION_TYPE_NONE)