Source-Changes-HG archive

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

[src/trunk]: src/bin/ps Fix problem in option processing, would segfault when...



details:   https://anonhg.NetBSD.org/src/rev/3c48416ed81b
branches:  trunk
changeset: 486023:3c48416ed81b
user:      mjl <mjl%NetBSD.org@localhost>
date:      Thu May 11 08:52:30 2000 +0000

description:
Fix problem in option processing, would segfault when parsing "-O,".
Closes PR/10096 by Yuji Yamano using the patch provided.

diffstat:

 bin/ps/keyword.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cb458eb22cab -r 3c48416ed81b bin/ps/keyword.c
--- a/bin/ps/keyword.c  Thu May 11 08:22:40 2000 +0000
+++ b/bin/ps/keyword.c  Thu May 11 08:52:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keyword.c,v 1.21 1999/12/03 02:26:36 simonb Exp $      */
+/*     $NetBSD: keyword.c,v 1.22 2000/05/11 08:52:30 mjl Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)keyword.c  8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: keyword.c,v 1.21 1999/12/03 02:26:36 simonb Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.22 2000/05/11 08:52:30 mjl Exp $");
 #endif
 #endif /* not lint */
 
@@ -224,7 +224,7 @@
 
                while ((cp = strsep(&p, FMTSEP)) != NULL && *cp == '\0')
                        /* void */;
-               if (!(v = findvar(cp)))
+               if (cp == NULL || !(v = findvar(cp)))
                        continue;
                if ((vent = malloc(sizeof(struct varent))) == NULL)
                        err(1, NULL);



Home | Main Index | Thread Index | Old Index