Sun Oct 15 03:16:07 2017 UTC ()
moria: disable fortify, try to put sense into package.

avoid implicit declarations - add includes where necessary, use
memset rather than bzero while at it - it's the more portable one.

avoid global buffer overflow found via asan.

disable fortify because it still won't run and no tool I've tried found
what's wrong. it's corrupting the GOT at init according to gdb.

bump PKGREVISION


(maya)
diff -r1.19 -r1.20 pkgsrc/games/moria/Makefile
diff -r1.13 -r1.14 pkgsrc/games/moria/distinfo
diff -r1.2 -r1.3 pkgsrc/games/moria/patches/patch-ac
diff -r1.3 -r1.4 pkgsrc/games/moria/patches/patch-ad
diff -r0 -r1.1 pkgsrc/games/moria/patches/patch-source_generate.c
diff -r0 -r1.1 pkgsrc/games/moria/patches/patch-source_tables.c

cvs diff -r1.19 -r1.20 pkgsrc/games/moria/Makefile (expand / switch to unified diff)

--- pkgsrc/games/moria/Makefile 2017/01/03 21:50:53 1.19
+++ pkgsrc/games/moria/Makefile 2017/10/15 03:16:07 1.20
@@ -1,32 +1,34 @@ @@ -1,32 +1,34 @@
1# $NetBSD: Makefile,v 1.19 2017/01/03 21:50:53 roy Exp $ 1# $NetBSD: Makefile,v 1.20 2017/10/15 03:16:07 maya Exp $
2 2
3DISTNAME= um5.5.2 3DISTNAME= um5.5.2
4PKGNAME= moria-5.5.2 4PKGNAME= moria-5.5.2
5PKGREVISION= 5 5PKGREVISION= 6
6CATEGORIES= games 6CATEGORIES= games
7# The "offical" master site has lost the pub/Games directory. 7# The "offical" master site has lost the pub/Games directory.
8#MASTER_SITES= ftp://ftp.cis.ksu.edu/pub/Games/Moria/source/ 8#MASTER_SITES= ftp://ftp.cis.ksu.edu/pub/Games/Moria/source/
9MASTER_SITES= ftp://ftp.funet.fi/pub/unix/games/moria/source/ 9MASTER_SITES= ftp://ftp.funet.fi/pub/unix/games/moria/source/
10EXTRACT_SUFX= .tar.Z 10EXTRACT_SUFX= .tar.Z
11 11
12MAINTAINER= simonb@NetBSD.org 12MAINTAINER= simonb@NetBSD.org
13HOMEPAGE= http://remarque.org/~grabiner/moria.html 13HOMEPAGE= http://remarque.org/~grabiner/moria.html
14#HOMEPAGE= http://www-math.bgsu.edu/~grabine/moria.html 14#HOMEPAGE= http://www-math.bgsu.edu/~grabine/moria.html
15COMMENT= Rogue-like game with a different sense of scale than Rogue 15COMMENT= Rogue-like game with a different sense of scale than Rogue
16 16
17WRKSRC= ${WRKDIR}/umoria 17WRKSRC= ${WRKDIR}/umoria
18MAKE_FLAGS+= CURSES=-l${BUILDLINK_LIBNAME.curses} VARBASE=${VARBASE} 18MAKE_FLAGS+= CURSES=-l${BUILDLINK_LIBNAME.curses} VARBASE=${VARBASE}
19 19
20INSTALLATION_DIRS= bin ${PKGMANDIR}/man6 20INSTALLATION_DIRS= bin ${PKGMANDIR}/man6
21 21
22SETGIDGAME= yes 22SETGIDGAME= yes
23CONF_FILES_PERMS+= /dev/null ${VARBASE}/games/moria.scores \ 23CONF_FILES_PERMS+= /dev/null ${VARBASE}/games/moria.scores \
24 ${GAMES_USER} ${GAMES_GROUP} ${GAMEDATAMODE} 24 ${GAMES_USER} ${GAMES_GROUP} ${GAMEDATAMODE}
25SPECIAL_PERMS= bin/moria ${SETGID_GAMES_PERMS} 25SPECIAL_PERMS= bin/moria ${SETGID_GAMES_PERMS}
26 26
27do-configure: 27do-configure:
28 @${RM} -f ${WRKSRC}/*.[ch] ${WRKSRC}/Makefile 28 @${RM} -f ${WRKSRC}/*.[ch] ${WRKSRC}/Makefile
29 @cd ${WRKSRC}; ${LN} -s source/* unix/* . 29 @cd ${WRKSRC}; ${LN} -s source/* unix/* .
30 30
 31PKGSRC_USE_FORTIFY=no
 32
31.include "../../mk/curses.buildlink3.mk" 33.include "../../mk/curses.buildlink3.mk"
32.include "../../mk/bsd.pkg.mk" 34.include "../../mk/bsd.pkg.mk"

cvs diff -r1.13 -r1.14 pkgsrc/games/moria/distinfo (expand / switch to unified diff)

--- pkgsrc/games/moria/distinfo 2015/11/03 20:56:59 1.13
+++ pkgsrc/games/moria/distinfo 2017/10/15 03:16:07 1.14
@@ -1,20 +1,22 @@ @@ -1,20 +1,22 @@
1$NetBSD: distinfo,v 1.13 2015/11/03 20:56:59 agc Exp $ 1$NetBSD: distinfo,v 1.14 2017/10/15 03:16:07 maya Exp $
2 2
3SHA1 (um5.5.2.tar.Z) = 69c7a7bf4e2c5be123ee7a82f5ad12ad5d0f5b08 3SHA1 (um5.5.2.tar.Z) = 69c7a7bf4e2c5be123ee7a82f5ad12ad5d0f5b08
4RMD160 (um5.5.2.tar.Z) = 1556c76f151d7ea29da79071a57398f63d0b138b 4RMD160 (um5.5.2.tar.Z) = 1556c76f151d7ea29da79071a57398f63d0b138b
5SHA512 (um5.5.2.tar.Z) = 987bbccb9cb4870ec91704cd20cf19875320d1cfe62c4c5a0063bfc3827732a0e3334a4ea3712137f3262d7418db0ea7e803d724e2dec4d5eb41ebe741f326cc 5SHA512 (um5.5.2.tar.Z) = 987bbccb9cb4870ec91704cd20cf19875320d1cfe62c4c5a0063bfc3827732a0e3334a4ea3712137f3262d7418db0ea7e803d724e2dec4d5eb41ebe741f326cc
6Size (um5.5.2.tar.Z) = 910536 bytes 6Size (um5.5.2.tar.Z) = 910536 bytes
7SHA1 (patch-aa) = 45338539960c193e9f7556aa6a588cf40bfbe726 7SHA1 (patch-aa) = 45338539960c193e9f7556aa6a588cf40bfbe726
8SHA1 (patch-ab) = 21418a69d7a694894dd9408513693f87fff91953 8SHA1 (patch-ab) = 21418a69d7a694894dd9408513693f87fff91953
9SHA1 (patch-ac) = ea9e23de0a147f317a579a4a04502cb165b4c4bd 9SHA1 (patch-ac) = aefb05ebf219bcf803d92409937f48a65c0a6b0a
10SHA1 (patch-ad) = f83f4596677b8d37493145f82a4d2d5cb489b53a 10SHA1 (patch-ad) = a13dade7ce548ed078870db8b63548d0a91265dc
11SHA1 (patch-ae) = 5cf8ad7c6e5d87856a31a5456ba9ed2422075988 11SHA1 (patch-ae) = 5cf8ad7c6e5d87856a31a5456ba9ed2422075988
12SHA1 (patch-af) = f8a9f32dffa2123512e36c774ca75e0b28a053cc 12SHA1 (patch-af) = f8a9f32dffa2123512e36c774ca75e0b28a053cc
13SHA1 (patch-ag) = af425b9a48c17f170fc780909b7287264a053cc4 13SHA1 (patch-ag) = af425b9a48c17f170fc780909b7287264a053cc4
14SHA1 (patch-ah) = e5eb295222a007a83600d9ed17ef0a0e0fd24875 14SHA1 (patch-ah) = e5eb295222a007a83600d9ed17ef0a0e0fd24875
15SHA1 (patch-ai) = ab8de35dad1870edb8549966aca60d0f5bdf2187 15SHA1 (patch-ai) = ab8de35dad1870edb8549966aca60d0f5bdf2187
16SHA1 (patch-aj) = f0ac2b33ce021f3c2757bb37e9a5749842901556 16SHA1 (patch-aj) = f0ac2b33ce021f3c2757bb37e9a5749842901556
17SHA1 (patch-ak) = 3b39f9bd883cae5cd0a8a2561fcb1bcdbfa0bc1b 17SHA1 (patch-ak) = 3b39f9bd883cae5cd0a8a2561fcb1bcdbfa0bc1b
18SHA1 (patch-al) = 0625fd70eeecaa7e0b5f5874b180244fb1f034c2 18SHA1 (patch-al) = 0625fd70eeecaa7e0b5f5874b180244fb1f034c2
19SHA1 (patch-am) = b5d250e9b870e3540c382c7e7c588e1f1c5a4910 19SHA1 (patch-am) = b5d250e9b870e3540c382c7e7c588e1f1c5a4910
20SHA1 (patch-source_files_c) = 56d4c89b4ab2b0e916f06a39cfb25b8cb6a52877 20SHA1 (patch-source_files_c) = 56d4c89b4ab2b0e916f06a39cfb25b8cb6a52877
 21SHA1 (patch-source_generate.c) = 2f659fab5d7a54a93b2abeea16ef9540b5d76466
 22SHA1 (patch-source_tables.c) = b934535fdf8d1ee53e24538ff92be591d72e4b6c

cvs diff -r1.2 -r1.3 pkgsrc/games/moria/patches/patch-ac (expand / switch to unified diff)

--- pkgsrc/games/moria/patches/patch-ac 2004/04/26 10:55:27 1.2
+++ pkgsrc/games/moria/patches/patch-ac 2017/10/15 03:16:07 1.3
@@ -1,18 +1,33 @@ @@ -1,18 +1,33 @@
1$NetBSD: patch-ac,v 1.2 2004/04/26 10:55:27 seb Exp $ 1$NetBSD: patch-ac,v 1.3 2017/10/15 03:16:07 maya Exp $
2 2
3--- source/config.h.orig 1994-07-22 01:47:13.000000000 +0000 3--- source/config.h.orig 1994-07-22 01:47:13.000000000 +0000
4+++ source/config.h 4+++ source/config.h
5@@ -200,16 +200,18 @@ some of the system defines set up here. 5@@ -12,6 +12,14 @@ Constant.h should always be included aft
 6 some of the system defines set up here.
 7 #endif
 8
 9+#include <sys/stat.h>
 10+
 11+#include <time.h>
 12+#include <stdio.h>
 13+#include <stdlib.h>
 14+#include <string.h>
 15+#include <unistd.h>
 16+
 17 /* Person to bother if something goes wrong. */
 18 /* Recompile files.c and misc2.c if this changes. */
 19 #define WIZARD "David Grabiner"
 20@@ -200,16 +208,18 @@ some of the system defines set up here.
6  21
7 /* This must be unix; change MORIA_LIB as appropriate. */ 22 /* This must be unix; change MORIA_LIB as appropriate. */
8 #define MORIA_SAV "moria.save" 23 #define MORIA_SAV "moria.save"
9-#define MORIA_LIB(xxx) "/home/math/grabiner/moria/files/xxx" 24-#define MORIA_LIB(xxx) "/home/math/grabiner/moria/files/xxx"
10-#define MORIA_HOU MORIA_LIB(hours) 25-#define MORIA_HOU MORIA_LIB(hours)
11-#define MORIA_MOR MORIA_LIB(news) 26-#define MORIA_MOR MORIA_LIB(news)
12-#define MORIA_TOP MORIA_LIB(scores) 27-#define MORIA_TOP MORIA_LIB(scores)
13-#define MORIA_HELP MORIA_LIB(roglcmds.hlp) 28-#define MORIA_HELP MORIA_LIB(roglcmds.hlp)
14-#define MORIA_ORIG_HELP MORIA_LIB(origcmds.hlp) 29-#define MORIA_ORIG_HELP MORIA_LIB(origcmds.hlp)
15-#define MORIA_WIZ_HELP MORIA_LIB(rwizcmds.hlp) 30-#define MORIA_WIZ_HELP MORIA_LIB(rwizcmds.hlp)
16-#define MORIA_OWIZ_HELP MORIA_LIB(owizcmds.hlp) 31-#define MORIA_OWIZ_HELP MORIA_LIB(owizcmds.hlp)
17-#define MORIA_WELCOME MORIA_LIB(welcome.hlp) 32-#define MORIA_WELCOME MORIA_LIB(welcome.hlp)
18-#define MORIA_VER MORIA_LIB(version.hlp) 33-#define MORIA_VER MORIA_LIB(version.hlp)

cvs diff -r1.3 -r1.4 pkgsrc/games/moria/patches/patch-ad (expand / switch to unified diff)

--- pkgsrc/games/moria/patches/patch-ad 2007/03/06 23:25:48 1.3
+++ pkgsrc/games/moria/patches/patch-ad 2017/10/15 03:16:07 1.4
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1$NetBSD: patch-ad,v 1.3 2007/03/06 23:25:48 rillig Exp $ 1$NetBSD: patch-ad,v 1.4 2017/10/15 03:16:07 maya Exp $
2--- source/io.c.orig 1994-07-22 03:47:26.000000000 +0200 2--- source/io.c.orig 1994-07-22 01:47:26.000000000 +0000
3+++ source/io.c 2007-03-07 00:06:06.234247718 +0100 3+++ source/io.c
4@@ -90,12 +90,19 @@ typedef struct { int stuff; } fpvmach; 4@@ -90,12 +90,19 @@ typedef struct { int stuff; } fpvmach;
5 #include <sys/types.h> 5 #include <sys/types.h>
6 #endif 6 #endif
7  7
8+#if (defined(BSD) && BSD >= 199306) /* XXX for all post 1993 BSDs? */ 8+#if (defined(BSD) && BSD >= 199306) /* XXX for all post 1993 BSDs? */
9+#include <sgtty.h> 9+#include <sgtty.h>
10+#endif 10+#endif
11+ 11+
12 #ifdef USG 12 #ifdef USG
13 #ifndef ATARI_ST 13 #ifndef ATARI_ST
14 #include <string.h> 14 #include <string.h>
15 #else 15 #else
16 #include "string.h" 16 #include "string.h"
@@ -20,26 +20,35 @@ $NetBSD: patch-ad,v 1.3 2007/03/06 23:25 @@ -20,26 +20,35 @@ $NetBSD: patch-ad,v 1.3 2007/03/06 23:25
20+#endif 20+#endif
21 #if 0 21 #if 0
22 /* Used to include termio.h here, but that caused problems on some systems, 22 /* Used to include termio.h here, but that caused problems on some systems,
23 as curses.h includes it also above. */ 23 as curses.h includes it also above. */
24@@ -245,7 +252,7 @@ int suspend() 24@@ -245,7 +252,7 @@ int suspend()
25 struct ltchars lcbuf; 25 struct ltchars lcbuf;
26 struct tchars cbuf; 26 struct tchars cbuf;
27 int lbuf; 27 int lbuf;
28- long time(); 28- long time();
29+ time_t time(); 29+ time_t time();
30  30
31 py.misc.male |= 2; 31 py.misc.male |= 2;
32 (void) ioctl(0, TIOCGETP, (char *)&tbuf); 32 (void) ioctl(0, TIOCGETP, (char *)&tbuf);
 33@@ -313,7 +320,7 @@ void init_curses()
 34 #endif
 35
 36 /* PC curses returns ERR */
 37-#if defined(USG) && !defined(PC_CURSES) && !defined(AMIGA)
 38+#if 1
 39 if (initscr() == NULL)
 40 #else
 41 if (initscr() == ERR)
33@@ -331,7 +338,7 @@ void init_curses() 42@@ -331,7 +338,7 @@ void init_curses()
34 #if defined(atarist) && defined(__GNUC__) 43 #if defined(atarist) && defined(__GNUC__)
35 (void) signal (SIGTSTP, (__Sigfunc)suspend); 44 (void) signal (SIGTSTP, (__Sigfunc)suspend);
36 #else 45 #else
37-#ifdef __386BSD__ 46-#ifdef __386BSD__
38+#if defined(__386BSD__) || (defined(BSD) && BSD >= 199306) 47+#if defined(__386BSD__) || (defined(BSD) && BSD >= 199306)
39 (void) signal (SIGTSTP, (sig_t)suspend); 48 (void) signal (SIGTSTP, (sig_t)suspend);
40 #else 49 #else
41 (void) signal (SIGTSTP, suspend); 50 (void) signal (SIGTSTP, suspend);
42@@ -419,7 +426,7 @@ void moriaterm() 51@@ -419,7 +426,7 @@ void moriaterm()
43 init_color (3,1000, 500, 0); /* pen 3 - orange */ 52 init_color (3,1000, 500, 0); /* pen 3 - orange */
44 #else 53 #else
45 #if !defined(ATARI_ST) && !defined(VMS) 54 #if !defined(ATARI_ST) && !defined(VMS)

File Added: pkgsrc/games/moria/patches/patch-source_generate.c
$NetBSD: patch-source_generate.c,v 1.1 2017/10/15 03:16:07 maya Exp $

Always use memset over bzero.
As opposed to implicitly declaring bzero, and because memset is a
part of the C standard.

--- source/generate.c.orig	1994-07-22 01:47:23.000000000 +0000
+++ source/generate.c
@@ -123,9 +123,6 @@ int *rdir, *cdir;
 /* Blanks out entire cave				-RAK-	*/
 static void blank_cave()
 {
-#ifndef USG
-  bzero ((char *)&cave[0][0], sizeof (cave));
-#else
 #ifdef MAC
   /* On the mac, cave is a pointer, so sizeof(cave) = 4! */
   (void)memset((char *)&cave[0][0], 0,
@@ -133,7 +130,6 @@ static void blank_cave()
 #else
   (void)memset((char *)&cave[0][0], 0, sizeof (cave));
 #endif
-#endif
 }
 
 

File Added: pkgsrc/games/moria/patches/Attic/patch-source_tables.c
$NetBSD: patch-source_tables.c,v 1.1 2017/10/15 03:16:07 maya Exp $

Avoid global buffer overflow

--- source/tables.c.orig	1994-07-22 01:47:47.000000000 +0000
+++ source/tables.c
@@ -13,7 +13,7 @@
 #ifdef MORIA_HOU
 /* Operating hours for Moria				-RAK-	*/
 /*	 X = Open; . = Closed					*/
-char  days[7][29] = { "SUN:XXXXXXXXXXXXXXXXXXXXXXXX",
+char  days[7][30] =  { "SUN:XXXXXXXXXXXXXXXXXXXXXXXX",
 		    "MON:XXXXXXXX.........XXXXXXX",
 		    "TUE:XXXXXXXX.........XXXXXXX",
 		    "WED:XXXXXXXX.........XXXXXXX",