Add code for checking size when notification data is "null" 78/179978/1
authorInkyun Kil <inkyun.kil@samsung.com>
Wed, 23 May 2018 23:41:21 +0000 (08:41 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Wed, 23 May 2018 23:41:21 +0000 (08:41 +0900)
Change-Id: I16d4e84724adae499f489541bbbe34de14d8c756
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
alarm-manager-registry.c

index 60da8ee..6702481 100644 (file)
@@ -176,6 +176,7 @@ void _load_alarms_from_registry()
        int i = 0;
        int col_idx;
        const char *query = "select * from alarmmgr";
+       const char *null_str = "null";
        sqlite3_stmt *stmt = NULL;
        const char *tail = NULL;
        alarm_info_t *alarm_info = NULL;
@@ -232,6 +233,7 @@ void _load_alarms_from_registry()
                strncpy(bundle, (const char *)sqlite3_column_text(stmt, col_idx++),
                        MAX_BUNDLE_NAME_LEN - 1);
                noti_len = sqlite3_column_int(stmt, col_idx++);
+               noti_len = noti_len ? noti_len : strlen(null_str);
                noti = calloc(1, noti_len + 1);
                strncpy(noti, (const char *)sqlite3_column_text(stmt, col_idx++),
                        noti_len);