]> granicus.if.org Git - procps-ng/commitdiff
skill: ensure optarg is not null [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Sun, 5 Feb 2012 19:54:58 +0000 (20:54 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 5 Feb 2012 19:54:58 +0000 (20:54 +0100)
skill.c:549 skillsnice_parse(87) error: we previously assumed 'optarg' could be null (see line 539)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
skill.c

diff --git a/skill.c b/skill.c
index e7ec5ec88e941d8ba470f1fc128d6b798c930ece..68025424151e5f56b07e2f6cad8bc41644fe9261 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -546,7 +546,7 @@ static void skillsnice_parse(int argc,
                                        ENLIST(tty, sbuf.st_rdev);
                                        if (!NEXTARG)
                                                break;
-                               } else if (!(optarg[1])) {
+                               } else if (optarg && !(optarg[1])) {
                                        /* if only 1 character */
                                        switch (*optarg) {
                                        default: