]> granicus.if.org Git - procps-ng/commitdiff
pidof: Do not skip the NULL terminator in cmdline.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:32:21 +0000 (07:32 +1000)
This should never happen (cmdline[0] should always be non-NULL), but
just in case.

pidof.c

diff --git a/pidof.c b/pidof.c
index c2b2eb4cbddf6b0fa5842a4746105e5c49c79fcd..7394c8a68b9c409f6344b5cc319c154f9a6c38d5 100644 (file)
--- 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;