[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Coverity fix for games/hunt
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Coverity fix for games/hunt
- From: Jasper Lievisse Adriaanse <jasper_(_at_)_nedbsd_(_dot_)_nl>
- Date: Wed, 22 Mar 2006 19:15:50 +0100
---------------------8<---------------------
Coverity CID 1443, from christos_(_at_)_netbsd_(_dot_)_org
Index: hunt/otto.c
===================================================================
RCS file: /cvs/src/games/hunt/hunt/otto.c,v
retrieving revision 1.8
diff -u -r1.8 otto.c
--- hunt/otto.c 7 Aug 2003 20:19:10 -0000 1.8
+++ hunt/otto.c 22 Mar 2006 17:51:21 -0000
@@ -294,7 +294,8 @@
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;
}
@@ -314,7 +315,8 @@
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;
}
---------------------8<---------------------
Coverity CID 1003, from abs_(_at_)_netbsd_(_dot_)_org
Index: huntd/shots.c
===================================================================
RCS file: /cvs/src/games/hunt/huntd/shots.c,v
retrieving revision 1.8
diff -u -r1.8 shots.c
--- huntd/shots.c 16 Jan 2004 00:13:19 -0000 1.8
+++ huntd/shots.c 22 Mar 2006 17:51:22 -0000
@@ -415,7 +415,7 @@
/* Tell the bullet owner they missed: */
if (bp->b_owner != NULL)
- message(bp->b_owner,
+ message(bp->b_owner, bp->b_score &&
((bp->b_score->i_missed & 0x7) == 0x7) ?
"My! What a bad shot you are!" :
"Missed him");
---------------------8<---------------------
Cheers,
Jasper
--
Humppa is a serious thing!
[demime 1.01d removed an attachment of type application/pgp-signature]
Visit your host, monkey.org