Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2015 09:29:32 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r282464 - head/usr.bin/checknr
Message-ID:  <201505050929.t459TWU9064070@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Tue May  5 09:29:32 2015
New Revision: 282464
URL: https://svnweb.freebsd.org/changeset/base/282464

Log:
  Ensure we read existing values of the stk table
  
  Obtained from:	NetBSD

Modified:
  head/usr.bin/checknr/checknr.c

Modified: head/usr.bin/checknr/checknr.c
==============================================================================
--- head/usr.bin/checknr/checknr.c	Tue May  5 09:26:32 2015	(r282463)
+++ head/usr.bin/checknr/checknr.c	Tue May  5 09:29:32 2015	(r282464)
@@ -341,7 +341,8 @@ process(FILE *f)
 						n = 10 * n + line[i] - '0';
 					i--;
 					if (n == 0) {
-						if (stk[stktop].opno == SZ) {
+						if (stktop >= 0 &&
+						    stk[stktop].opno == SZ) {
 							stktop--;
 						} else {
 							pe(lineno);
@@ -356,7 +357,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505050929.t459TWU9064070>