Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/pkill Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/cda0c7b00ce3
branches:  netbsd-7
changeset: 800162:cda0c7b00ce3
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Mar 18 05:13:22 2017 +0000

description:
Pull up following revision(s) (requested by kre in ticket #1365):
        usr.bin/pkill/pkill.c: revision 1.31
PR bin/50934 -- avoid core dump if a process being examined has set
its argv[0] to NULL.

diffstat:

 usr.bin/pkill/pkill.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r f6953a9c0643 -r cda0c7b00ce3 usr.bin/pkill/pkill.c
--- a/usr.bin/pkill/pkill.c     Sat Mar 18 05:02:28 2017 +0000
+++ b/usr.bin/pkill/pkill.c     Sat Mar 18 05:13:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkill.c,v 1.29.8.1 2015/01/27 13:39:31 martin Exp $    */
+/*     $NetBSD: pkill.c,v 1.29.8.2 2017/03/18 05:13:22 snj Exp $       */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pkill.c,v 1.29.8.1 2015/01/27 13:39:31 martin Exp $");
+__RCSID("$NetBSD: pkill.c,v 1.29.8.2 2017/03/18 05:13:22 snj Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -296,8 +296,10 @@
                                            pargv[0]);
                                        pargv++;
                                }
-                       } else
+                       } else if (pargv[0] != NULL)
                                strlcpy(buf, pargv[0], sizeof(buf));
+                       else
+                               strlcpy(buf, kp->p_comm, sizeof(buf));
 
                        rv = regexec(&reg, buf, 1, &regmatch, 0);
                        if (rv == 0) {



Home | Main Index | Thread Index | Old Index