|
|
b12e4c |
From 4ba33cbe861d0c4dc50fd513c76bedd782833b94 Mon Sep 17 00:00:00 2001
|
|
|
b12e4c |
From: Ernestas Kulik <ekulik@redhat.com>
|
|
|
b12e4c |
Date: Wed, 16 Oct 2019 16:46:54 +0200
|
|
|
b12e4c |
Subject: [PATCH] lib: problem_data: Add a null-guard for g_strsplit() call
|
|
|
b12e4c |
|
|
|
b12e4c |
99d045d33f9805d7f81012d2bf7f01edcddb97f2 replaced a reinvented wheel
|
|
|
b12e4c |
with GLib API. However, null strings are not legal arguments in
|
|
|
b12e4c |
calls to g_strsplit().
|
|
|
b12e4c |
|
|
|
b12e4c |
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
|
|
|
b12e4c |
---
|
|
|
b12e4c |
src/lib/problem_data.c | 9 ++++++++-
|
|
|
b12e4c |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
b12e4c |
|
|
|
b12e4c |
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
|
|
|
b12e4c |
index c2bbd65..c4dad37 100644
|
|
|
b12e4c |
--- a/src/lib/problem_data.c
|
|
|
b12e4c |
+++ b/src/lib/problem_data.c
|
|
|
b12e4c |
@@ -523,9 +523,16 @@ problem_data_t *create_problem_data_from_dump_dir(struct dump_dir *dd)
|
|
|
b12e4c |
problem_data_t *create_problem_data_for_reporting(const char *dump_dir_name)
|
|
|
b12e4c |
{
|
|
|
b12e4c |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
b12e4c |
+ char *exclude_items_string;
|
|
|
b12e4c |
+ char **exclude_items = NULL;
|
|
|
b12e4c |
if (!dd)
|
|
|
b12e4c |
return NULL; /* dd_opendir already emitted error msg */
|
|
|
b12e4c |
- char **exclude_items = g_strsplit(getenv("EXCLUDE_FROM_REPORT"), ",", -1);
|
|
|
b12e4c |
+
|
|
|
b12e4c |
+ exclude_items_string = getenv("EXCLUDE_FROM_REPORT");
|
|
|
b12e4c |
+ if (NULL != exclude_items_string)
|
|
|
b12e4c |
+ {
|
|
|
b12e4c |
+ exclude_items = g_strsplit(exclude_items_string, ",", -1);
|
|
|
b12e4c |
+ }
|
|
|
b12e4c |
problem_data_t *problem_data = problem_data_new();
|
|
|
b12e4c |
problem_data_load_from_dump_dir(problem_data, dd, exclude_items);
|
|
|
b12e4c |
dd_close(dd);
|
|
|
b12e4c |
--
|
|
|
b12e4c |
2.23.0
|
|
|
b12e4c |
|