Mercurial > hg > early-roguelike
annotate rogue3/configure.ac @ 176:db1c9a21a7c3
srogue: prevent overflowing the score file name.
If SCOREFILE is not defined, roguehome() is called to find a directory
for the score file. It copies up to PATH_MAX-20 bytes from an
environment variable to a static buffer. Later these are strcpy()'d to
scorefile, which is of size LINLEN. Unfortunately LINLEN is 80 and
PATH_MAX is at least 256. On Linux, it happens to be 4096.
I haven't yet managed to crash or exploit it, but there are surely no
beneficial consequences, so roguehome() has been modified to check the
length, and the string it returns is also checked in main().
author | John "Elwin" Edwards |
---|---|
date | Sun, 02 Aug 2015 12:14:47 -0400 |
parents | 5238b835d661 |
children | 0e99eade579c |
rev | line source |
---|---|
88 | 1 # -*- Autoconf -*- |
2 # Process this file with autoconf to produce a configure script. | |
3 | |
4 AC_PREREQ(2.56) | |
5 AC_INIT([Rogue],[3.6.4], [yendor@rogueforge.net]) | |
6 AC_CONFIG_HEADERS([config.h]) | |
7 # May not be needed for the documentation | |
8 AC_CONFIG_FILES([Makefile rogue.6 rogue.r]) | |
9 | |
10 # Checks for programs. | |
11 AC_PROG_CC | |
12 # Checks for libraries. | |
13 MP_WITH_CURSES | |
14 # Checks for header files. | |
15 AC_HEADER_STDC | |
16 AC_CHECK_HEADERS([arpa/inet.h pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h utmpx.h term.h ncurses/term.h process.h]) | |
17 # WARN: the sources often don't include the headers when needed. That is one | |
18 # reason why adding "-Wall" to CFLAGS produces 1246 lines of messages. | |
19 | |
20 # Checks for typedefs, structures, and compiler characteristics. | |
21 AC_TYPE_UID_T | |
22 AC_TYPE_SIZE_T | |
23 AC_STRUCT_TM | |
24 # Checks for library functions. | |
25 AC_FUNC_FORK | |
26 AC_PROG_GCC_TRADITIONAL | |
27 AC_FUNC_LSTAT | |
28 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK | |
29 AC_TYPE_SIGNAL | |
30 AC_FUNC_STAT | |
31 AC_FUNC_VPRINTF | |
32 AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid]) | |
33 AC_PROG_INSTALL | |
34 | |
35 # Programs to process the documentation | |
36 AC_CHECK_PROG([NROFF], [nroff], [nroff],) | |
37 AC_CHECK_PROG([GROFF], [groff], [groff],) | |
38 AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],) | |
39 AC_CHECK_PROG([TBL], [tbl], [tbl],) | |
40 AC_CHECK_PROG([SED], [sed], [sed],) | |
41 | |
42 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="rogue3"] ) | |
43 PROGRAM=$progname | |
44 AC_SUBST(PROGRAM) | |
45 | |
46 AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@])],[],[]) | |
47 AC_MSG_CHECKING([if using setgid execute bit]) | |
48 if test "x$enable_setgid" = "xno" ; then | |
49 GROUPOWNER= | |
50 elif test "x$enable_setgid" = "xyes" ; then | |
51 GROUPOWNER=games | |
52 elif test "x$enable_setgid" = "x" ; then | |
53 GROUPOWNER= | |
54 else | |
55 GROUPOWNER=$enable_setgid | |
56 fi | |
57 | |
58 if test "x$GROUPOWNER" != "x" ; then | |
59 AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) | |
60 AC_MSG_RESULT([$GROUPOWNER]) | |
61 else | |
62 AC_MSG_RESULT([no]) | |
63 fi | |
64 | |
65 AC_SUBST(GROUPOWNER) | |
66 | |
67 AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) | |
68 AC_MSG_CHECKING([for scoreboard file]) | |
69 if test "x$enable_scorefile" = "xno" ; then | |
70 SCOREFILE= | |
71 elif test "x$enable_scorefile" = "xyes" ; then | |
72 SCOREFILE=$progname.scr | |
73 elif test "x$enable_scorefile" = "x" ; then | |
74 SCOREFILE=$progname.scr | |
75 else | |
76 SCOREFILE=$enable_scorefile | |
77 fi | |
78 | |
79 if test "x$SCOREFILE" != "x" ; then | |
80 AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) | |
81 AC_MSG_RESULT([$SCOREFILE]) | |
82 else | |
83 AC_MSG_RESULT([disabled]) | |
84 fi | |
85 | |
86 AC_SUBST(SCOREFILE) | |
87 | |
88 AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[]) | |
89 AC_MSG_CHECKING([for log file]) | |
90 if test "x$enable_logfile" = "xno" ; then | |
91 LOGFILE= | |
92 elif test "x$enable_logfile" = "xyes" ; then | |
93 LOGFILE=$progname.log | |
94 elif test "x$enable_logfile" = "x" ; then | |
07c4d4883ef2
rogue3: begin porting to autoconf.
John "Elwin" Edwards |