From 38845abe74f06408e4b1971593b574670454b82b Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Fri, 26 Jan 2018 10:07:54 +0900 Subject: [PATCH] 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 --- src/notification_noti.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/notification_noti.c b/src/notification_noti.c index 9d964ae..a799fb1 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) -- 2.7.4