aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-05 09:29:32 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-05 09:29:32 +0000
commitca887f8d070d0bd2da705d10b9719d50b702f134 (patch)
tree5c9295e563e57bf5a08b26164616b4ee8693ae32 /usr.bin
parent0a2963a2ac89fa1e6fa7dd5638807c9cbd183469 (diff)
downloadsrc-ca887f8d070d0bd2da705d10b9719d50b702f134.tar.gz
src-ca887f8d070d0bd2da705d10b9719d50b702f134.zip
Ensure we read existing values of the stk table
Obtained from: NetBSD
Notes
Notes: svn path=/head/; revision=282464
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/checknr/checknr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
index 01d3216afc5f..c150b795e41a 100644
--- a/usr.bin/checknr/checknr.c
+++ b/usr.bin/checknr/checknr.c
@@ -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);