summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2009-11-12 23:53:25 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2009-11-12 23:53:25 +0000
commitb5bab4525c29585d9abd4df44d904b0c479f557b (patch)
tree5e95c4791b0f60d13e6846a6bba59aa6a969a17e /games
parentb17ad1e58c55bcbc0a00d59ba5d41b5cf4f15902 (diff)
fix an off by one in loop termination
found by parfait ok deraadt@
Diffstat (limited to 'games')
-rw-r--r--games/snake/snscore.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/games/snake/snscore.c b/games/snake/snscore.c
index 70cfc7bae47..0e49bbd919f 100644
--- a/games/snake/snscore.c
+++ b/games/snake/snscore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snscore.c,v 1.7 2009/10/27 23:59:27 deraadt Exp $ */
+/* $OpenBSD: snscore.c,v 1.8 2009/11/12 23:53:24 jsg Exp $ */
/* $NetBSD: snscore.c,v 1.5 1995/04/24 12:25:43 cgd Exp $ */
/*
@@ -105,7 +105,7 @@ snscore(int fd, int topn)
if ((topn > 0) && (topn < noplayers))
noplayers = topn;
j = 1;
- for (i = 0; i < noplayers; i++) {
+ for (i = 0; i < noplayers - 1; i++) {
printf("%d:\t$%d\t%s\n", j, players[i].scores, players[i].name);
if (players[i].scores > players[i + 1].scores)
j = i + 2;