From: Sami Kerola <kerolasa@iki.fi>
Date: Sun, 5 Feb 2012 19:54:58 +0000 (+0100)
Subject: skill: ensure optarg is not null [smatch scan]
X-Git-Tag: v3.3.3~102
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cd53e16b5229196eda23a5c90404654b07de0c7;p=procps-ng

skill: ensure optarg is not null [smatch scan]

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>
---

diff --git a/skill.c b/skill.c
index e7ec5ec8..68025424 100644
--- 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: