diff options
author | christos <christos@NetBSD.org> | 2006-03-19 00:00:19 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2006-03-19 00:00:19 +0000 |
commit | b284b24896a2f0f173af4cffd241244a540cd407 (patch) | |
tree | 0e30cc35297450001b26e920d4dd2100de87a0cc /hunt | |
parent | d425ea7991773e7a64d9d22b91d2d245c6a717e7 (diff) | |
download | bsdgames-darwin-b284b24896a2f0f173af4cffd241244a540cd407.tar.gz bsdgames-darwin-b284b24896a2f0f173af4cffd241244a540cd407.tar.zst bsdgames-darwin-b284b24896a2f0f173af4cffd241244a540cd407.zip |
Coverity CID 1443: Prevent static overrun.
Diffstat (limited to 'hunt')
-rw-r--r-- | hunt/hunt/otto.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/hunt/hunt/otto.c b/hunt/hunt/otto.c index 8cda1803..3c069713 100644 --- a/hunt/hunt/otto.c +++ b/hunt/hunt/otto.c @@ -1,4 +1,4 @@ -/* $NetBSD: otto.c,v 1.9 2006/03/17 23:36:38 abs Exp $ */ +/* $NetBSD: otto.c,v 1.10 2006/03/19 00:00:19 christos Exp $ */ # ifdef OTTO /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -45,7 +45,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: otto.c,v 1.9 2006/03/17 23:36:38 abs Exp $"); +__RCSID("$NetBSD: otto.c,v 1.10 2006/03/19 00:00:19 christos Exp $"); #endif /* not lint */ # include <sys/time.h> @@ -335,7 +335,8 @@ ottolook(rel_dir, itemp) cont_north: if (itemp->flags & DEADEND) { itemp->flags |= BEEN; - been_there[r][col] |= NORTH; + if (r >= 0) + been_there[r][col] |= NORTH; for (r = row - 1; r > row - itemp->distance; r--) been_there[r][col] = ALLDIRS; } @@ -355,7 +356,8 @@ ottolook(rel_dir, itemp) cont_south: if (itemp->flags & DEADEND) { itemp->flags |= BEEN; - been_there[r][col] |= SOUTH; + if (r < HEIGHT) + been_there[r][col] |= SOUTH; for (r = row + 1; r < row + itemp->distance; r++) been_there[r][col] = ALLDIRS; } |