summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-misc/bsd-games/files/bsd-games-2.17-tetris.patch')
-rw-r--r--games-misc/bsd-games/files/bsd-games-2.17-tetris.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/games-misc/bsd-games/files/bsd-games-2.17-tetris.patch b/games-misc/bsd-games/files/bsd-games-2.17-tetris.patch
new file mode 100644
index 000000000000..5a6fb1f22735
--- /dev/null
+++ b/games-misc/bsd-games/files/bsd-games-2.17-tetris.patch
@@ -0,0 +1,42 @@
+--- bsd-games-2.13/tetris/scores.c.orig 2006-02-10 18:11:41.704770280 +0000
++++ bsd-games-2.13/tetris/scores.c 2006-02-10 18:25:15.927989536 +0000
+@@ -339,7 +339,8 @@
+ continue;
+ }
+ }
+- levelfound[sp->hs_level] = 1;
++ if (sp->hs_level < NLEVELS && sp->hs_level >= 0)
++ levelfound[sp->hs_level] = 1;
+ i++, sp++;
+ }
+ return (num > MAXHISCORES ? MAXHISCORES : num);
+@@ -378,12 +379,14 @@
+ for (i = MINLEVEL; i < NLEVELS; i++)
+ levelfound[i] = 0;
+ for (i = 0, sp = scores; i < nscores; i++, sp++) {
+- if (levelfound[sp->hs_level])
+- sp->hs_time = 0;
+- else {
+- sp->hs_time = 1;
+- levelfound[sp->hs_level] = 1;
+- }
++ if (sp->hs_level < NLEVELS && sp->hs_level >= 0) {
++ if (levelfound[sp->hs_level])
++ sp->hs_time = 0;
++ else {
++ sp->hs_time = 1;
++ levelfound[sp->hs_level] = 1;
++ }
++ }
+ }
+
+ /*
+@@ -437,7 +440,7 @@
+ continue;
+ }
+ sp = &hs[item];
+- (void)sprintf(buf,
++ (void)snprintf(buf, sizeof(buf),
+ "%3d%c %6d %-11s (%6d on %d)",
+ item + offset, sp->hs_time ? '*' : ' ',
+ sp->hs_score * sp->hs_level,