Release 5.6.36 60/229660/1 accepted/tizen/5.5/unified/20200403.153233 submit/tizen_5.5/20200402.132109
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 2 Apr 2020 13:06:50 +0000 (15:06 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 2 Apr 2020 13:06:50 +0000 (15:06 +0200)
Change-Id: I9ce23297693b869fd4189c0eacbd24347e4f66ed

packaging/crash-worker.spec
src/dump_systemstate/extras.c
src/shared/config.c
src/shared/config.h

index c405a49..fd32f97 100644 (file)
@@ -13,7 +13,7 @@
 
 Name:           crash-worker
 Summary:        Coredump handler and report generator for Tizen
-Version:        6.0.14
+Version:        5.5.36
 Release:        1
 Group:          Framework/system
 License:        Apache-2.0 and BSD-2-Clause and MIT
index 016acf6..6f17b34 100644 (file)
@@ -106,11 +106,11 @@ int handle_extra_program(int out_fd, struct extra_dump_item *item, int argc, cha
        assert(out_fd >= 0);
        assert(item);
 
-       const char *const title = item->fields[INI_FIELD_TITLE];
-       const char *const path  = item->fields[INI_FIELD_PATH];
-       const char *const args  = item->fields[INI_FIELD_ARGS] ?: "";
-       const char *const env   = item->fields[INI_FIELD_ENV] ?: "";
-       const char *const flag  = item->fields[INI_FIELD_FLAG];
+       char *const title = item->fields[INI_FIELD_TITLE];
+       char *const path  = item->fields[INI_FIELD_PATH];
+       char *const args  = item->fields[INI_FIELD_ARGS] ?: "";
+       char *const env   = item->fields[INI_FIELD_ENV] ?: "";
+       char *const flag  = item->fields[INI_FIELD_FLAG];
 
        if (!check_cmdflag(flag, argc, argv))
                return 0;
@@ -149,8 +149,8 @@ int handle_extra_file(int out_fd, struct extra_dump_item *item, int argc, char *
        assert(out_fd >= 0);
        assert(item);
 
-       const char *const title = item->fields[INI_FIELD_TITLE];
-       const char *const path  = item->fields[INI_FIELD_PATH];
+       char *const title = item->fields[INI_FIELD_TITLE];
+       char *const path  = item->fields[INI_FIELD_PATH];
        if (!title || !path) {
                fprintf_fd(out_fd, "\nNo title or path in extra file config");
                return EXIT_CONFERR;
@@ -167,14 +167,14 @@ int handle_extra_file(int out_fd, struct extra_dump_item *item, int argc, char *
 
 typedef int (*handle_ini_section_t)(int out_fd, struct extra_dump_item *, int argc, char **argv);
 
-static int handle_ini_Nth_section(struct extra_dump_item *item, const dictionary *ini, int n)
+static int handle_ini_Nth_section(struct extra_dump_item *item, dictionary *ini, int n)
 {
        assert(item);
        assert(ini);
        assert(n >= 0);
        assert(n < iniparser_getnsec(ini));
 
-       const char *const secname = iniparser_getsecname(ini, n);
+       char *const secname = iniparser_getsecname(ini, n);
        assert(secname); // can only be NULL if `ini` is NULL or `n` is outta bounds
 
        const size_t secname_len = strlen(secname);
@@ -183,11 +183,11 @@ static int handle_ini_Nth_section(struct extra_dump_item *item, const dictionary
        key_buf[secname_len] = ':';
 
        int ret = 0;
-       char *const key_suffix_ptr = key_buf + secname_len + 1;
+       char *key_suffix_ptr = key_buf + secname_len + 1;
        for (size_t i = 0; i < ARRAY_SIZE(item->fields); ++i) {
                strcpy(key_suffix_ptr, INI_KEYS[i]);
 
-               const char *tmp = iniparser_getstring(ini, key_buf, NULL);
+               char *tmp = iniparser_getstring(ini, key_buf, NULL);
                if (!tmp) {
                        item->fields[i] = NULL;
                        continue;
@@ -199,7 +199,7 @@ static int handle_ini_Nth_section(struct extra_dump_item *item, const dictionary
        }
 
        strcpy(key_suffix_ptr, "order");
-       const char *tmp = iniparser_getstring(ini, key_buf, NULL);
+       char *tmp = iniparser_getstring(ini, key_buf, NULL);
        item->order = tmp ? atoi(tmp) : INT_MAX;
 
        return ret;
index 60f168e..b3bce77 100644 (file)
@@ -53,7 +53,7 @@ enum ReportType report_type_from_str(const char *report_type_str)
        return REP_TYPE_INVALID;
 }
 
-static int config_load_exclude_paths(config_t *c, const dictionary *ini)
+static int config_load_exclude_paths(config_t *c, dictionary *ini)
 {
        assert(c);
        assert(ini);
@@ -63,16 +63,16 @@ static int config_load_exclude_paths(config_t *c, const dictionary *ini)
        if (n <= 0)
                return 0;
 
-       const char **keys = alloca(sizeof(char *) * n);
        int total = n + c->n_exclude_paths;
        int n_added = 0;
 
-       c->exclude_paths = reallocarray(c->exclude_paths, sizeof(char *), total);
+       c->exclude_paths = realloc(c->exclude_paths, sizeof(char *) * total);
 
-       if (!keys || !c->exclude_paths)
+       if (!c->exclude_paths)
                goto err_oom;
 
-       keys = iniparser_getseckeys(ini, EXCLUDEPATHS_SECTION, keys);
+       // keys are destroyed by iniparser
+       char **keys = iniparser_getseckeys(ini, EXCLUDEPATHS_SECTION);
        if (!keys)
                goto err_oom;
 
@@ -109,7 +109,7 @@ bool config_is_path_excluded(config_t *c, const char *const path)
        return false;
 }
 
-static bool config_load_from_dict(config_t *c, const dictionary *ini)
+static bool config_load_from_dict(config_t *c, dictionary *ini)
 {
        assert(c);
        assert(ini);
index 00b71b7..e209dfb 100644 (file)
 #define LEGACY_NOTIFICATION  0
 
 #define CRASH_SECTION        "CrashManager"
-#define EXCLUDEPATHS_SECTION  "ExcludePaths"
+
+/* ExcludePaths section name must be lowercase with iniparser 3.x.
+ *
+ * This is to workaround for iniparser 3.x bug, where loaded strings
+ * are converted to lowercase, but query string is not, precisely
+ * getsecnkeys() does strcmp(lowercase-key-in-db, user-provided-str).
+ */
+#define EXCLUDEPATHS_SECTION "excludepaths"
 
 enum ReportType {
        REP_TYPE_INVALID = -1,