Fix problem in option processing, would segfault when parsing "-O,".

Closes PR/10096 by Yuji Yamano using the patch provided.
This commit is contained in:
mjl 2000-05-11 08:52:30 +00:00
parent 214b560694
commit 4ecbad3425

View File

@ -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 @@ parsefmt(p)
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);