From 6a78126eecd1f3e22dcfbc295790b7699d895b46 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 18 Mar 2006 23:14:45 +0000 Subject: Coverity CID 1295: Don't allow cchose to return a negative number. It is used as an index. --- cribbage/support.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cribbage/support.c b/cribbage/support.c index 6cc20ac1..1b4cec0a 100644 --- a/cribbage/support.c +++ b/cribbage/support.c @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.8 2005/07/02 08:32:32 jmc Exp $ */ +/* $NetBSD: support.c,v 1.9 2006/03/18 23:14:45 christos Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: support.c,v 1.8 2005/07/02 08:32:32 jmc Exp $"); +__RCSID("$NetBSD: support.c,v 1.9 2006/03/18 23:14:45 christos Exp $"); #endif #endif /* not lint */ @@ -114,6 +114,10 @@ cchose(const CARD h[], int n, int s) break; } } + if (j < 0) { + printf("\ncchose: internal error %d %d\n", j, n); + exit(93); + } return (j); } -- cgit v1.2.3-56-ge451