|
|
a60cd7 |
From b6d744ffd5e70b410c960ace62c68094bbbd045c Mon Sep 17 00:00:00 2001
|
|
|
a60cd7 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
Date: Fri, 9 Jan 2015 16:34:00 +0100
|
|
|
a60cd7 |
Subject: [ABRT PATCH 87/87] abrt-auto-reporting: make the code more safer
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Uncovered by coverity.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Related: #1174833
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
---
|
|
|
a60cd7 |
src/daemon/abrt-auto-reporting.c | 10 +++++++++-
|
|
|
a60cd7 |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
diff --git a/src/daemon/abrt-auto-reporting.c b/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
index f50c4c2..f3b4ed0 100644
|
|
|
a60cd7 |
--- a/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
+++ b/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
@@ -50,6 +50,8 @@ const char *const REPORTING_STATES[8][2] = {
|
|
|
a60cd7 |
static int
|
|
|
a60cd7 |
set_abrt_reporting(map_string_t *conf, const char *opt_value)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
+ assert(opt_value != NULL || !"BUG: invalid auto-reporting state");
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
const char *const def_value = REPORTING_STATES[0][1];
|
|
|
a60cd7 |
const char *const cur_value = get_map_string_item_or_NULL(conf, OPTION_NAME);
|
|
|
a60cd7 |
|
|
|
a60cd7 |
@@ -356,7 +358,13 @@ int main(int argc, char *argv[])
|
|
|
a60cd7 |
goto finito;
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- exit_code = set_abrt_reporting(conf, opt_value) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
a60cd7 |
+ if (opt_value == NULL)
|
|
|
a60cd7 |
+ { /* calm coverity: see 'if (argc ...)' statements above. 0 exits, >1 fails, 1 sets opt_value */
|
|
|
a60cd7 |
+ error_msg("BUG: invalid command line arguments");
|
|
|
a60cd7 |
+ exit_code = EXIT_FAILURE;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+ else
|
|
|
a60cd7 |
+ exit_code = set_abrt_reporting(conf, opt_value) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
a60cd7 |
|
|
|
a60cd7 |
if (exit_code == EXIT_FAILURE)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
--
|
|
|
a60cd7 |
1.8.3.1
|
|
|
a60cd7 |
|