Commit Graph

55 Commits

Author SHA1 Message Date
dholland
6a214fad9e Disable writing scores when built for /rescue. PR 42009 2009-09-08 13:38:01 +00:00
dholland
1e99780e5d sprinkle static 2009-08-12 08:44:45 +00:00
dholland
e5909fd6fe Don't use a variable-size array here. There's not really that much point. 2009-06-01 04:03:26 +00:00
dholland
e32a40eb27 Clean up scorefile handling.
This was writing time_t to disk. Worse, the time_t member was at an
unaligned offset in the structure in question, so after the time_t
change the structure layout depended on compiler-inserted structure
padding. This gives three legacy formats: one with 32-bit time, one
with 64-bit time, and one with 64-bit time and 4 bytes of structure
padding.

And of course the file didn't have a header or version coding or
anything.

The new code writes a structure of well-defined size that should not
receive unexpected padding, and gives the file a header and version
number. It reads that format and any of the three legacy formats,
figuring out which one it's dealing with by inspecting the file
contents. For good measure, it also now handles opposite-endian files,
doesn't bail out unceremoniously unless necessary, and won't croak if
the file is corrupt and e.g. contains unterminated strings.

(Was it worth going to this length? Maybe not. But it didn't seem
right to just leave it, and it's not clear where to stop halfway.)
2009-05-25 08:33:57 +00:00
dholland
bbc67e0f7a ANSIfy function declarations.
Some object file diffs, but they are harmless. (Mostly they seem to
come from internal counters in gcc... and in one case the order of two
instructions was harmlessly swapped, which is odd and annoying.)
2009-05-25 04:33:53 +00:00
dholland
b398836923 sprintf -> snprintf 2009-05-25 00:46:01 +00:00
lukem
2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
dholland
d4f48e67da Make the default WARNS for games 4. The only game that needs to set WARNS
to anything else now is rogue, so clear WARNS from the other makefiles.
2008-01-28 07:03:58 +00:00
dholland
bded8baaa8 Build with WARNS=4. (All fixes are cosmetic, except that it's definitely
bad karma to shadow a local variable with another of the same name in a
nested block...)
2008-01-28 01:38:59 +00:00
perry
8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
perry
36c7456d7c include sys/cdefs.h so that __attribute__ can be fixed later 2007-12-15 16:32:05 +00:00
mrg
fd5635ed7a don't discard const. GCC 4.1-20061021 doesn't like that... 2006-10-22 08:09:24 +00:00
drochner
3f13a4cf7b Better check data read from tetris.scores before use as array indices etc.
This is CVE-2006-1539, files against Gentoo Linux, the patch is from
Gentoo.
A standard NetBSD installation is not as much risk because tetris is
sgid "games", and users shouldn't be in that group.
2006-06-01 16:12:27 +00:00
christos
989c7cd825 Coverity CID 868: Fix possible NULL deref (after INFTIM passes :-) 2006-03-19 00:50:28 +00:00
wiz
d9f5a9df01 Use standard AUTHORS section header. From YOMURA Masanori in private mail
Sort sections if necessary. Use more/better markup.
2005-09-15 02:09:41 +00:00
jsm
cb5fd8342e Remove uses of __P. 2004-01-27 20:30:28 +00:00
agc
e5aeb4ea46 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22269, verified by myself.
2003-08-07 09:36:50 +00:00
kristerw
c5fc68a463 Correct some comments and error messages that still talked about "select".
Solves the last part of PR 18905.
2002-12-29 15:12:17 +00:00
jmmv
0e4487574e Fix a bug in rwait() introduced during the select() to poll() conversion
that caused tetris to crash when pausing the game. Approved by tron.
2002-12-26 20:15:11 +00:00
wiz
c91d8d6b9b Lots of minor fixes resulting from reading these man pages in detail. 2002-09-26 18:31:58 +00:00
mycroft
804a85524e select() -> poll() 2002-09-19 21:12:10 +00:00
wiz
10b0b6bce0 de-register 2002-06-02 22:17:37 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
christos
1703d1eee6 Update to the new t_agetstr() API. 2001-11-02 18:27:00 +00:00
wiz
834bb1b3ab Whitespace and/or punctuation fixes. 2001-04-02 22:42:37 +00:00
blymn
99bf72c6bb Fix core dump. 2000-05-24 14:43:00 +00:00
blymn
494e4c93a6 Converted games to use the new termcap interface. 2000-05-22 12:42:46 +00:00
jsm
233f519d3d Clean up error reporting in tetris. 2000-01-21 02:10:56 +00:00
jsm
7e681e294b Fix high score table formatting bug.
Bug report and fix from Malcolm Parsons <malcolm@bits.bris.ac.uk>.
2000-01-21 00:54:53 +00:00
jsm
e2dbfa95c5 Declare variables as extern in headers rather than using linker commons. 2000-01-01 10:15:17 +00:00
lukem
88d3d7c59e update after change to return value of tputs() third argument 1999-10-04 23:26:59 +00:00
jsm
20e3305006 Fix -Wsign-compare warnings. 1999-09-18 19:38:46 +00:00
jsm
010f0ab865 Convert tetris to use <err.h> functions. 1999-09-17 20:44:51 +00:00
jsm
5367f3400c Security improvements for games (largely from or inspired by OpenBSD).
Games which run setgid from dm, but don't need to, should drop their
privileges at startup.

Games which have a scorefile should open it at startup, then drop all
privileges leaving just the open writable file descriptor.  If the
game can invoke subprocesses, this should be made close-on-exec.

Games with scorefiles should make sure they do not get a file
descriptor < 3.  (Otherwise, they could get confused and corrupt the
scorefile when using stdin, stdout or stderr.)

Some old setuid revokes from the days of setuid games change into gid
revokes.
1999-09-12 09:02:20 +00:00
jsm
b03d4fa882 Add __noreturn__' and __unused__' attributes where appropriate to
the games.

This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Most noreturn attributes were previously added in bin/6144, with some
others that were missed then in bin/8082.  Previous `unused'
attributes were covered in bin/6557, bin/8058 and other PRs (all these
PRs have already been handled and closed).
1999-09-08 21:45:25 +00:00
jsm
092d313019 Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
1999-09-08 21:17:44 +00:00
tron
7cef41650e Adapt to change of "termcap.h". 1999-08-14 16:38:45 +00:00
abs
0a265153fb Newline and usage cosmetics from Soren S. Jorvang <soren@t.dk> PR7205 1999-03-22 06:12:23 +00:00
simonb
6372fa90cc Remove unneeded "mips compiler bug" workaround from original code imported
in 1994.
1999-02-11 02:34:24 +00:00
hubertf
6cfbee5947 only show preview if the -p option is given 1999-01-03 17:13:51 +00:00
hubertf
f42c52bee6 Add previewing of next shape. Old (previous) behaviour can be
restored by compiling with NO_PREVIEW defined.
1999-01-03 02:00:17 +00:00
hubertf
1c9494f62b mark non-returning functions (PR#6144 by Joseph Myers <jsm28@cam.ac.uk>) 1998-09-13 15:27:25 +00:00
perry
e31adf91d8 bzero->memset 1998-08-10 02:23:45 +00:00
mrg
6074e1b476 install games that need it setgid. 1997-11-20 00:12:30 +00:00
lukem
2ce4ef15e6 use <termcap.h> 1997-10-14 01:14:20 +00:00
lukem
161dd44953 minor WARNSify 1997-10-12 02:03:45 +00:00
mikel
b3f39d1b48 fix typo; from Hubert Feyrer in PR bin/4070 1997-09-01 23:26:11 +00:00
cgd
c917dfb5b2 Fix broken uses of Dd. Both the mdoc and mdoc.samples pages agree:
.Dd is supposed to be invoked like:
	.Dd month day, year
e.g. ".Dd January 25, 1989", rather than:
	.Dd "month day, year"
which is what these pages did.
1997-05-29 01:48:05 +00:00
tls
af1ee80179 bfunctions -> memfunctions 1997-01-13 06:50:25 +00:00
jtc
5224609738 Removed "extern int errno"; Added #include <errno.h> if not already present. 1996-02-06 22:47:06 +00:00