From b284b24896a2f0f173af4cffd241244a540cd407 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 19 Mar 2006 00:00:19 +0000 Subject: Coverity CID 1443: Prevent static overrun. --- hunt/hunt/otto.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'hunt') 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 #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 @@ -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; } -- cgit v1.2.3-56-ge451