diff options
author | Jean-Yves Lefort <jylefort@FreeBSD.org> | 2005-09-02 12:12:49 +0000 |
---|---|---|
committer | Jean-Yves Lefort <jylefort@FreeBSD.org> | 2005-09-02 12:12:49 +0000 |
commit | 230b0114051b8b47950e5e78adfa34e2747dc227 (patch) | |
tree | b73056d15cbd898b80fd32f7074ae06be39492de /games | |
parent | Update to DAT 4572 (diff) |
- Fix several stack overflow bugs which allowed local users to elevate their
privileges to the games group [1]
- When deinstalling, remove the score file if it is empty
- Polish the port
Submitted by: shaun@rsc.cx [1]
Security: fix local games group privilege escalation
Notes
Notes:
svn path=/head/; revision=141780
Diffstat (limited to 'games')
-rw-r--r-- | games/urban/Makefile | 50 | ||||
-rw-r--r-- | games/urban/files/patch-configure | 52 | ||||
-rw-r--r-- | games/urban/files/patch-src::config::config.cc | 26 | ||||
-rw-r--r-- | games/urban/files/patch-src::engine::game.cc | 39 | ||||
-rw-r--r-- | games/urban/files/patch-src::highscor::highscor.cc | 36 | ||||
-rw-r--r-- | games/urban/files/patch-src::meny::meny.cc | 26 | ||||
-rw-r--r-- | games/urban/pkg-plist | 7 |
7 files changed, 145 insertions, 91 deletions
diff --git a/games/urban/Makefile b/games/urban/Makefile index f0539aa795ce..e0c83aceb515 100644 --- a/games/urban/Makefile +++ b/games/urban/Makefile @@ -5,46 +5,46 @@ # $FreeBSD$ # -PORTNAME= urban -PORTVERSION= 1.5.3 -PORTREVISION= 1 -CATEGORIES= games -MASTER_SITES= http://urban.bengburken.net/files/linux/ -DIST_SUBDIR= urban +PORTNAME= urban +PORTVERSION= 1.5.3 +PORTREVISION= 2 +CATEGORIES= games +MASTER_SITES= http://urban.bengburken.net/files/linux/ +DIST_SUBDIR= urban -MAINTAINER= jylefort@FreeBSD.org -COMMENT= A bloody, violent sidescrolling shoot-em-up +MAINTAINER= jylefort@FreeBSD.org +COMMENT= A bloody, violent sidescrolling shoot-em-up -LIB_DEPENDS= ggi:${PORTSDIR}/graphics/libggi \ - mikmod:${PORTSDIR}/audio/libmikmod +LIB_DEPENDS= ggi:${PORTSDIR}/graphics/libggi \ + mikmod:${PORTSDIR}/audio/libmikmod -USE_X_PREFIX= yes -GNU_CONFIGURE= yes -CFLAGS+= ${PTHREAD_CFLAGS} -CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ - LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" -CONFIGURE_ARGS= --with-global-highscore=/var/games/urban.scores +USE_REINPLACE= yes +USE_X_PREFIX= yes +GNU_CONFIGURE= yes +CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" +CONFIGURE_ARGS= --with-global-highscore=/var/games/urban.scores -OPTIONS= CHEAT_CODES "Enable cheat codes" off +PORTDOCS= AUTHORS CHEAT NEWS README README.swe + +OPTIONS= CHEAT_CODES "Enable cheat codes" off .include <bsd.port.pre.mk> .if defined(WITH_CHEAT_CODES) -CONFIGURE_ARGS+= --enable-cheat-codes +CONFIGURE_ARGS+=--enable-cheat-codes .endif +post-patch: + @${REINPLACE_CMD} -e 's|-D_REENTRANT|${PTHREAD_CFLAGS}|; \ + s|-lpthread|${PTHREAD_LIBS}|; \ + /^LIBS=/ s|-lggi|& ${PTHREAD_LIBS}|' ${WRKSRC}/configure + post-install: ${CHGRP} games ${PREFIX}/bin/urban ${CHMOD} g+s ${PREFIX}/bin/urban .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} - ${INSTALL_DATA} \ - ${WRKSRC}/AUTHORS \ - ${WRKSRC}/CHEAT \ - ${WRKSRC}/NEWS \ - ${WRKSRC}/README \ - ${WRKSRC}/README.swe \ - ${DOCSDIR} + ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${DOCSDIR} .endif @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${CAT} ${PKGMESSAGE} diff --git a/games/urban/files/patch-configure b/games/urban/files/patch-configure deleted file mode 100644 index 3efd80f6fb04..000000000000 --- a/games/urban/files/patch-configure +++ /dev/null @@ -1,52 +0,0 @@ ---- configure.orig Sun Jan 25 03:50:44 2004 -+++ configure Sun Jan 25 04:28:46 2004 -@@ -1501,47 +1501,8 @@ - fi - done - --echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6 --echo "configure:1506: checking for pthread_mutex_init in -lpthread" >&5 --ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'` --if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then -- echo $ac_n "(cached) $ac_c" 1>&6 --else -- ac_save_LIBS="$LIBS" --LIBS="-lpthread $LIBS" --cat > conftest.$ac_ext <<EOF --#line 1514 "configure" --#include "confdefs.h" --/* Override any gcc2 internal prototype to avoid an error. */ --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char pthread_mutex_init(); -- --int main() { --pthread_mutex_init() --; return 0; } --EOF --if { (eval echo configure:1525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -- rm -rf conftest* -- eval "ac_cv_lib_$ac_lib_var=yes" --else -- echo "configure: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- rm -rf conftest* -- eval "ac_cv_lib_$ac_lib_var=no" --fi --rm -f conftest* --LIBS="$ac_save_LIBS" -- --fi --if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then -- echo "$ac_t""yes" 1>&6 -- PTHREAD_LIBS="-lpthread" --else -- echo "$ac_t""no" 1>&6 --{ echo "configure: error: "Urban needs pthreads"" 1>&2; exit 1; } --fi -- -+# PTHREAD_LIBS will be set in LDFLAGS by the FreeBSD port -+PTHREAD_LIBS= - - - # Check whether --with-libmikmod-prefix or --without-libmikmod-prefix was given. diff --git a/games/urban/files/patch-src::config::config.cc b/games/urban/files/patch-src::config::config.cc index 186039553552..0a0e2ee5e6bc 100644 --- a/games/urban/files/patch-src::config::config.cc +++ b/games/urban/files/patch-src::config::config.cc @@ -1,5 +1,27 @@ ---- src/config/config.cc.orig Sun Jun 6 15:37:17 1999 -+++ src/config/config.cc Sun Jan 25 23:34:40 2004 +--- src/config/config.cc.orig Fri Sep 2 13:26:20 2005 ++++ src/config/config.cc Fri Sep 2 13:27:53 2005 +@@ -24,7 +24,7 @@ + #ifdef DJGPP + sprintf(filename, "ctrl.dat"); + #else +- sprintf(filename, "%s/.urban/ctrl.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/ctrl.dat", getenv("HOME")); + #endif + + if(!(fd = fopen(filename, "rb"))) +@@ -43,10 +43,10 @@ + sprintf(filename, "ctrl.dat"); + #else + /* Create dir */ +- sprintf(filename, "%s/.urban", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban", getenv("HOME")); + mkdir(filename, S_IRUSR | S_IWUSR | S_IXUSR); + +- sprintf(filename, "%s/.urban/ctrl.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/ctrl.dat", getenv("HOME")); + #endif + if(!(fd = fopen(filename, "wb"))) + return; @@ -91,10 +91,10 @@ /* Ask for the number of buttons */ diff --git a/games/urban/files/patch-src::engine::game.cc b/games/urban/files/patch-src::engine::game.cc index 70ab31c132df..17dd0b4ec399 100644 --- a/games/urban/files/patch-src::engine::game.cc +++ b/games/urban/files/patch-src::engine::game.cc @@ -1,5 +1,5 @@ ---- src/engine/game.cc.orig Mon Jun 7 17:20:59 1999 -+++ src/engine/game.cc Sun Jan 25 23:33:14 2004 +--- src/engine/game.cc.orig Fri Sep 2 13:26:28 2005 ++++ src/engine/game.cc Fri Sep 2 13:27:53 2005 @@ -93,10 +93,10 @@ char *demo_filename; @@ -13,3 +13,38 @@ }; +@@ -263,7 +263,7 @@ + #ifdef DJGPP + sprintf(filename, "savegame.dat"); + #else +- sprintf(filename, "%s/.urban/savegame.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/savegame.dat", getenv("HOME")); + #endif + + if ((fs = fopen(filename, "rb")) == NULL) { +@@ -275,10 +275,10 @@ + } + #ifndef DJGPP + /* Create dir */ +- sprintf(filename, "%s/.urban", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban", getenv("HOME")); + mkdir(filename, S_IRUSR | S_IWUSR | S_IXUSR); + +- sprintf(filename, "%s/.urban/savegame.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/savegame.dat", getenv("HOME")); + #endif + if((fs = fopen(filename, "wb")) == NULL) + fwrite(SavedGames, 1, 5 * sizeof(struct SaveGameData), fs); +@@ -338,10 +338,10 @@ + sprintf(filename, "savegame.dat"); + #else + /* Create dir */ +- sprintf(filename, "%s/.urban", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban", getenv("HOME")); + mkdir(filename, S_IRUSR | S_IWUSR | S_IXUSR); + +- sprintf(filename, "%s/.urban/savegame.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/savegame.dat", getenv("HOME")); + #endif + if ((fs = fopen(filename, "wb")) != NULL) { + fwrite(SavedGames, 1, 5 * sizeof(struct SaveGameData), fs); diff --git a/games/urban/files/patch-src::highscor::highscor.cc b/games/urban/files/patch-src::highscor::highscor.cc index e1e80f6f8d45..8430fc2fd1b8 100644 --- a/games/urban/files/patch-src::highscor::highscor.cc +++ b/games/urban/files/patch-src::highscor::highscor.cc @@ -1,5 +1,5 @@ ---- src/highscor/highscor.cc.orig Tue Dec 14 06:30:56 2004 -+++ src/highscor/highscor.cc Tue Dec 14 06:31:19 2004 +--- src/highscor/highscor.cc.orig Fri Sep 2 13:26:47 2005 ++++ src/highscor/highscor.cc Fri Sep 2 13:27:53 2005 @@ -75,7 +75,7 @@ if(highscore[i].Level) @@ -9,6 +9,15 @@ else sprintf(buffer, " %-10s%6d 0:0", "Empty", 0); +@@ -100,7 +100,7 @@ + strcpy(Name, "Unknown"); + #else + if(getenv("USER") != NULL) +- strcpy(Name, getenv("USER")); ++ strncpy(Name, getenv("USER"), sizeof(Name)-1); + else + strcpy(Name, "Unknown"); + #endif @@ -166,13 +166,13 @@ for(int i = 0; i < NUM_HIGHSCORES; i++) { @@ -25,3 +34,26 @@ highscore[i].Level = level; break; } +@@ -192,7 +192,7 @@ + #else + char filename[1024]; + +- sprintf(filename, "%s/.urban/hs.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/hs.dat", getenv("HOME")); + + if((fd = fopen(filename, "rb")) == NULL) + #endif +@@ -215,11 +215,10 @@ + char filename[1024]; + + /* Create dir */ +- sprintf(filename, "%s/.urban", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban", getenv("HOME")); + mkdir(filename, S_IRUSR | S_IWUSR | S_IXUSR); + +- sprintf(filename, "%s/.urban/hs.dat", getenv("HOME")); +- ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/hs.dat", getenv("HOME")); + if((fd = fopen(filename, "wb")) == NULL) + #endif + #endif diff --git a/games/urban/files/patch-src::meny::meny.cc b/games/urban/files/patch-src::meny::meny.cc index 64f5627258de..86312c88e39f 100644 --- a/games/urban/files/patch-src::meny::meny.cc +++ b/games/urban/files/patch-src::meny::meny.cc @@ -1,5 +1,5 @@ ---- src/meny/meny.cc.orig Fri Jul 2 02:23:30 1999 -+++ src/meny/meny.cc Sun Jan 25 23:17:19 2004 +--- src/meny/meny.cc.orig Fri Sep 2 13:26:36 2005 ++++ src/meny/meny.cc Fri Sep 2 13:27:53 2005 @@ -124,7 +124,7 @@ return 1; } @@ -9,3 +9,25 @@ PALETTE pal; UrbanFont m(LARGE_FONT); m.SetScale(65); +@@ -194,7 +194,7 @@ + #ifdef DJGPP + sprintf(filename, "savegame.dat"); + #else +- sprintf(filename, "%s/.urban/savegame.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/savegame.dat", getenv("HOME")); + #endif + if ((fs = fopen(filename, "rb")) == NULL) { + for (int i = 0; i < 5;i++) { +@@ -203,10 +203,10 @@ + } + #ifndef DJGPP + /* Create dir */ +- sprintf(filename, "%s/.urban", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban", getenv("HOME")); + mkdir(filename, S_IRUSR | S_IWUSR | S_IXUSR); + +- sprintf(filename, "%s/.urban/savegame.dat", getenv("HOME")); ++ snprintf(filename, sizeof(filename)-1, "%s/.urban/savegame.dat", getenv("HOME")); + #endif + if((fs = fopen(filename, "wb")) != NULL) { + diff --git a/games/urban/pkg-plist b/games/urban/pkg-plist index 1fdb940e4fb5..e3e71dc050d9 100644 --- a/games/urban/pkg-plist +++ b/games/urban/pkg-plist @@ -2,10 +2,5 @@ bin/urban share/urban/intro.dat share/urban/levels.dat share/urban/urban.dat -%%PORTDOCS%%%%DOCSDIR%%/AUTHORS -%%PORTDOCS%%%%DOCSDIR%%/CHEAT -%%PORTDOCS%%%%DOCSDIR%%/NEWS -%%PORTDOCS%%%%DOCSDIR%%/README -%%PORTDOCS%%%%DOCSDIR%%/README.swe @dirrm share/urban -%%PORTDOCS%%@dirrm %%DOCSDIR%% +@unexec if [ ! -s /var/games/urban.scores ]; then rm -f /var/games/urban.scores 2>/dev/null; fi |