From owner-svn-src-head@FreeBSD.ORG Tue May 5 09:29:32 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6DF5641; Tue, 5 May 2015 09:29:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B61F3155A; Tue, 5 May 2015 09:29:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t459TWQ2064071; Tue, 5 May 2015 09:29:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t459TWU9064070; Tue, 5 May 2015 09:29:32 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505050929.t459TWU9064070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 5 May 2015 09:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282464 - head/usr.bin/checknr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 09:29:32 -0000 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);