From: Qualys Security Advisory <qsa@qualys.com>
Date: Thu, 1 Jan 1970 00:00:00 +0000 (+0000)
Subject: pidof: Do not skip the NULL terminator in cmdline.
X-Git-Tag: v3.3.15~124
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bba9f384c041b4f2d642670a72dea20afd3011a8;p=procps-ng

pidof: Do not skip the NULL terminator in cmdline.

This should never happen (cmdline[0] should always be non-NULL), but
just in case.
---

diff --git a/pidof.c b/pidof.c
index c2b2eb4c..7394c8a6 100644
--- a/pidof.c
+++ b/pidof.c
@@ -161,7 +161,7 @@ static void select_procs (void)
 			}
 		}
 
-		if (!is_omitted(task.XXXID) && task.cmdline) {
+		if (!is_omitted(task.XXXID) && task.cmdline && *task.cmdline) {
 
 			cmd_arg0 = *task.cmdline;