From 4d5030b7d46de75384ff6a1ab81d1c681ede8f07 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 25 Apr 2006 19:25:19 +0000 Subject: [PATCH] Coverity CID 2969: Check for negative stack in the 'P' case like we do in the 0 case. --- usr.bin/checknr/checknr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c index 81ae993f6baa..aa283bf875b4 100644 --- a/usr.bin/checknr/checknr.c +++ b/usr.bin/checknr/checknr.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93"; #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 /* not lint */ @@ -381,7 +381,8 @@ process(FILE *f) } else if (!fflag && line[i]=='f') { n = line[++i]; if (n == 'P') { - if (stk[stktop].opno == FT) { + if (stktop >= 0 && + stk[stktop].opno == FT) { stktop--; } else { pe(lineno);