From 2dbf5f70cedcafec2350e2178a2b9ae85997743b Mon Sep 17 00:00:00 2001 From: Marek Schimara Date: Wed, 15 Jun 2016 09:59:25 +0200 Subject: [PATCH] src/rrd_tune.c: fix Coverity CID#32424 Improper use of negative value CWE-394 / https://cwe.mitre.org/data/definitions/394.html Note: optparse_init() and optparse_long() which can modify the 'options' variable in rrd_tune() can never set options.optind to a negative value. --- src/rrd_tune.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/rrd_tune.c b/src/rrd_tune.c index 47163c28..03a16590 100644 --- a/src/rrd_tune.c +++ b/src/rrd_tune.c @@ -153,7 +153,7 @@ int rrd_tune( opt_daemon = NULL; } - if (options.optind < 0 || options.optind >= options.argc) { + if (!options.optind || options.optind >= options.argc) { // missing file name... rrd_set_error("missing file name"); goto done; @@ -405,10 +405,6 @@ int rrd_tune( } optind = handle_modify(&rrd, in_filename, options.argc, options.argv, options.optind + 1, opt_newstep); - if (options.optind < 0) { - goto done; - } - rc = 0; done: if (in_filename && rrdc_is_any_connected()) { -- 2.47.2