Coverity CID 2969: Check for negative stack in the 'P' case like we do in

the 0 case.
This commit is contained in:
christos 2006-04-25 19:25:19 +00:00
parent a781fb5f1e
commit 4d5030b7d4
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: checknr.c,v 1.18 2006/04/02 03:29:17 christos Exp $ */ /* $NetBSD: checknr.c,v 1.19 2006/04/25 19:25:19 christos Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
#else #else
__RCSID("$NetBSD: checknr.c,v 1.18 2006/04/02 03:29:17 christos Exp $"); __RCSID("$NetBSD: checknr.c,v 1.19 2006/04/25 19:25:19 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -381,7 +381,8 @@ process(FILE *f)
} else if (!fflag && line[i]=='f') { } else if (!fflag && line[i]=='f') {
n = line[++i]; n = line[++i];
if (n == 'P') { if (n == 'P') {
if (stk[stktop].opno == FT) { if (stktop >= 0 &&
stk[stktop].opno == FT) {
stktop--; stktop--;
} else { } else {
pe(lineno); pe(lineno);