From 997a1771487bd6641b2aa14c0d03c93735f6d6ee Mon Sep 17 00:00:00 2001 From: schwarze Date: Thu, 8 May 2014 23:12:40 +0000 Subject: [PATCH] Do not read from index -1 of an array. NetBSD rev. 1.16 (Oct 13, 2012) by dholland@NetBSD via maintainer pjanzen@. --- games/cribbage/score.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/games/cribbage/score.c b/games/cribbage/score.c index 59889574b35..a5a1b32b229 100644 --- a/games/cribbage/score.c +++ b/games/cribbage/score.c @@ -1,4 +1,4 @@ -/* $OpenBSD: score.c,v 1.9 2009/10/27 23:59:24 deraadt Exp $ */ +/* $OpenBSD: score.c,v 1.10 2014/05/08 23:12:40 schwarze Exp $ */ /* $NetBSD: score.c,v 1.3 1995/03/21 15:08:57 cgd Exp $ */ /*- @@ -295,7 +295,7 @@ pegscore(CARD crd, CARD tbl[], int n, int sum) if (!n) return (scr); j = 1; - while ((crd.rank == tbl[n - j].rank) && (n - j >= 0)) + while ((j <= n) && (crd.rank == tbl[n - j].rank)) ++j; if (j > 1) return (scr + ichoose2[j]); -- 2.20.1