summaryrefslogtreecommitdiffstats
path: root/adventure
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-03-18 23:33:38 +0000
committerchristos <christos@NetBSD.org>2006-03-18 23:33:38 +0000
commit3f1fdbd285757684e5ac5c43385ccfcce6f13081 (patch)
tree75896b104ec359e4faedae99522e0484b46293d3 /adventure
parentb22c03d38161d83cf068000f0f356ce84909d101 (diff)
downloadbsdgames-darwin-3f1fdbd285757684e5ac5c43385ccfcce6f13081.tar.gz
bsdgames-darwin-3f1fdbd285757684e5ac5c43385ccfcce6f13081.tar.zst
bsdgames-darwin-3f1fdbd285757684e5ac5c43385ccfcce6f13081.zip
Coverity CID 1195: Check for possible negative index.
Diffstat (limited to 'adventure')
-rw-r--r--adventure/io.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/adventure/io.c b/adventure/io.c
index 6ad8b0e5..44a88b52 100644
--- a/adventure/io.c
+++ b/adventure/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.17 2006/03/18 23:31:19 christos Exp $ */
+/* $NetBSD: io.c,v 1.18 2006/03/18 23:33:38 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: io.c,v 1.17 2006/03/18 23:31:19 christos Exp $");
+__RCSID("$NetBSD: io.c,v 1.18 2006/03/18 23:33:38 christos Exp $");
#endif
#endif /* not lint */
@@ -481,7 +481,10 @@ rliq(void)
if ((bitnum = rnum()) < 0)
break;
for (;;) { /* read locs for bits */
- cond[rnum()] |= setbit[bitnum];
+ int n = rnum();
+ if (n < 0)
+ break;
+ cond[n] |= setbit[bitnum];
if (breakch == LF)
break;
}