summaryrefslogtreecommitdiffstats
path: root/rogue
diff options
context:
space:
mode:
authorjnemeth <jnemeth@NetBSD.org>2006-03-30 05:04:22 +0000
committerjnemeth <jnemeth@NetBSD.org>2006-03-30 05:04:22 +0000
commit077906a20219a303a84eefc70fdc53f61fe9d38e (patch)
tree0c5059587be508b6d4579aadadce8b0a7370aa8c /rogue
parent2718bf9741cecdb5edccb0154e713f4c1caf87b1 (diff)
downloadbsdgames-darwin-077906a20219a303a84eefc70fdc53f61fe9d38e.tar.gz
bsdgames-darwin-077906a20219a303a84eefc70fdc53f61fe9d38e.tar.zst
bsdgames-darwin-077906a20219a303a84eefc70fdc53f61fe9d38e.zip
Coverity CID 2452: possible negative array index; CID 1518 and CID 1517: possible overrun of static array
Diffstat (limited to 'rogue')
-rw-r--r--rogue/throw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/rogue/throw.c b/rogue/throw.c
index af91b6dc..1531bb46 100644
--- a/rogue/throw.c
+++ b/rogue/throw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: throw.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */
+/* $NetBSD: throw.c,v 1.7 2006/03/30 05:04:22 jnemeth Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: throw.c,v 1.6 2003/08/07 09:37:40 agc Exp $");
+__RCSID("$NetBSD: throw.c,v 1.7 2006/03/30 05:04:22 jnemeth Exp $");
#endif
#endif /* not lint */
@@ -212,6 +212,9 @@ flop_weapon(weapon, row, col)
short mch, dch;
unsigned short mon;
+ if ((row < 0) || (row >= DROWS) || (col < 0) || (col >= DCOLS))
+ clean_up("flop_weapon: weapon landed outside of dungeon");
+
while ((i < 9) && dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER)) {
rand_around(i++, &row, &col);
if ((row > (DROWS-2)) || (row < MIN_ROW) ||