summaryrefslogtreecommitdiffstats
path: root/cribbage/support.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-03-18 23:14:45 +0000
committerchristos <christos@NetBSD.org>2006-03-18 23:14:45 +0000
commit6a78126eecd1f3e22dcfbc295790b7699d895b46 (patch)
tree532a288cd68b62f1182a3d4b8abee60c875e4034 /cribbage/support.c
parent0d7870ca669aae32c1290d20e6308f39bffc942c (diff)
downloadbsdgames-darwin-6a78126eecd1f3e22dcfbc295790b7699d895b46.tar.gz
bsdgames-darwin-6a78126eecd1f3e22dcfbc295790b7699d895b46.tar.zst
bsdgames-darwin-6a78126eecd1f3e22dcfbc295790b7699d895b46.zip
Coverity CID 1295: Don't allow cchose to return a negative number. It is
used as an index.
Diffstat (limited to 'cribbage/support.c')
-rw-r--r--cribbage/support.c8
1 files 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);
}