Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/pkill PR bin/50934 -- avoid core dump if a process b...



details:   https://anonhg.NetBSD.org/src/rev/e2b88bdf93c2
branches:  trunk
changeset: 821904:e2b88bdf93c2
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Feb 21 13:09:56 2017 +0000

description:
PR bin/50934 -- avoid core dump if a process being examined has set
its argv[0] to NULL.

XXX Needs pullups netbsd-7-0 and netbsd-7 (bug was introduced after
    netbsd-6 and never pulled up, so no netbsd-6 pullups required.)

diffstat:

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

diffs (30 lines):

diff -r 4284e3a87e14 -r e2b88bdf93c2 usr.bin/pkill/pkill.c
--- a/usr.bin/pkill/pkill.c     Tue Feb 21 10:53:37 2017 +0000
+++ b/usr.bin/pkill/pkill.c     Tue Feb 21 13:09:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkill.c,v 1.30 2015/01/09 12:45:32 prlw1 Exp $ */
+/*     $NetBSD: pkill.c,v 1.31 2017/02/21 13:09:56 kre Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pkill.c,v 1.30 2015/01/09 12:45:32 prlw1 Exp $");
+__RCSID("$NetBSD: pkill.c,v 1.31 2017/02/21 13:09:56 kre 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