Mercurial > hg > early-roguelike
annotate rogue4/Makefile.in @ 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 | 97f8fdf9595c |
children | 0e99eade579c |
rev | line source |
---|---|
51 | 1 # |
2 # Makefile for rogue | |
3 # @(#)Makefile 4.13 (Berkeley) 1/23/82 | |
4 # | |
5 # Rogue: Exploring the Dungeons of Doom | |
6 # Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman | |
7 # All rights reserved. | |
8 # | |
9 # See the file LICENSE.TXT for full copyright and licensing information. | |
10 # | |
11 | |
12 DISTNAME=@PACKAGE_TARNAME@@PACKAGE_VERSION@ | |
13 PACKAGE_TARNAME = @PACKAGE_TARNAME@-@PACKAGE_VERSION@ | |
14 PROGRAM=@PROGRAM@ | |
15 | |
16 CC = @CC@ | |
17 LIBS = @LIBS@ | |
18 | |
19 SCOREFILE=@SCOREFILE@ | |
20 LOGFILE=@LOGFILE@ | |
21 SAVEDIR=@SAVEDIR@ | |
22 LOCKFILE=@LOCKFILE@ | |
116
97f8fdf9595c
Makefiles: don't set defaults for CFLAGS.
John "Elwin" Edwards
parents:
109
diff
changeset
|
23 |
51 | 24 GROUPOWNER=@GROUPOWNER@ |
25 | |
93 | 26 DESTDIR= |
51 | 27 prefix=@prefix@ |
28 exec_prefix=@exec_prefix@ | |
29 datarootdir=@datarootdir@ | |
30 bindir=@bindir@ | |
31 mandir=@mandir@ | |
32 man6dir=$(mandir)/man6 | |
33 docdir=@docdir@ | |
34 | |
104
fbc75509f4cd
Add config.h to the list of headers in the Makefiles.
John "Elwin" Edwards
parents:
96
diff
changeset
|
35 HDRS= rogue.h extern.h config.h |
51 | 36 DOBJS= vers.o extern.o armor.o chase.o command.o daemon.o daemons.o \ |
37 fight.o init.o io.o list.o main.o misc.o monsters.o move.o \ | |
38 new_level.o options.o pack.o passages.o potions.o rings.o rip.o \ | |
39 rooms.o save.o scrolls.o state.o sticks.o things.o weapons.o wizard.o\ | |
40 xcrypt.o mdport.o | |
41 OBJS= $(DOBJS) mach_dep.o | |
42 CFILES= vers.c extern.c armor.c chase.c command.c daemon.c daemons.c \ | |
43 fight.c init.c io.c list.c main.c misc.c monsters.c move.c \ | |
44 new_level.c options.c pack.c passages.c potions.c rings.c rip.c \ | |
45 rooms.c save.c scrolls.c state.c sticks.c things.c weapons.c wizard.c \ | |
46 mach_dep.c xcrypt.c mdport.c | |
47 MISC= Makefile LICENSE.TXT rogue.6 rogue.me | |
48 | |
116
97f8fdf9595c
Makefiles: don't set defaults for CFLAGS.
John "Elwin" Edwards
parents:
109
diff
changeset
|
49 CFLAGS= |
109
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
50 CPPFLAGS=@DEFS@ |
51 | 51 CRLIB = -lcurses |
52 RM = rm -f | |
53 TAR = tar | |
54 TOUCH=touch | |
55 MKDIR=mkdir | |
56 CHGRP=chgrp | |
57 CHMOD=chmod | |
58 INSTALL=@INSTALL@ | |
59 | |
60 SF= | |
61 NAMELIST= | |
62 NL= | |
63 #MACHDEP= -DMAXLOAD=40 -DLOADAV -DCHECKTIME=4 | |
64 MACHDEP= | |
65 | |
66 .c.o: | |
109
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
67 @echo $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c |
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
68 @$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o |
51 | 69 # @cpp -P $(CFLAGS) $*.c | ./xstr -v -c - |
70 # @cc -c $(CFLAGS) x.c | |
71 # @mv x.o $*.o | |
72 | |
73 @PROGRAM@: $(HDRS) $(OBJS) # xs.o | |
74 # @rm -f x.c | |
75 # $(CC) $(LDFLAGS) xs.o $(OBJS) $(CRLIB) | |
76 $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ | |
77 | |
78 main.o: main.c $(HDRS) | |
109
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
79 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ main.c |
51 | 80 |
81 vers.o: | |
109
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
82 $(CC) -c $(CPPFLAGS) $(CFLAGS) vers.c |
51 | 83 |
84 mach_dep.o: mach_dep.c | |
109
ec9db3bb6b0b
rogue4: don't include config.h if it wasn't created.
John "Elwin" Edwards
parents:
104
diff
changeset
|
85 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(SF) $(NL) $(MACHDEP) mach_dep.c |
51 | 86 |
87 xs.o: strings | |
88 ./xstr | |
89 $(CC) -c $(CFLAGS) xs.c | |
90 | |
91 xstr: xstr.c | |
92 $(CC) -s -O -o xstr xstr.c | |
93 | |
94 findpw: findpw.c xcrypt.c | |
95 $(CC) -s -o findpw findpw.c xcrypt.c | |
96 | |
97 prob: prob.o extern.o xs.o | |
98 $(CC) -O -o prob prob.o extern.o xs.o | |
99 | |
100 prob.o: prob.c rogue.h | |
101 $(CC) -O -c prob.c | |
102 | |
103 clean: | |
104 rm -f $(POBJS) $(OBJS) core a.out p.out @PROGRAM@ strings make.out rogue.tar vgrind.* x.c x.o xs.c xs.o linterrs findpw distmod.o xs.po xstr rogue rogue.exe rogue.tar.gz rogue.cat rogue.doc xstr.exe | |
105 | |
106 maintainer-clean: | |