commit:     f2c4d6d57a2f38769508dffbc5a5adf86c6ec0b6
Author:     Tupone Alfredo <tupone <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 15:01:23 2016 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Mon Jan  4 15:02:00 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2c4d6d5

games-strategy/galaxyhack: Build with -Wformat-security. Bug #57069

Package-Manager: portage-2.2.24

 .../galaxyhack/files/galaxyhack-1.74-format.patch  | 64 ++++++++++++++++++++++
 games-strategy/galaxyhack/galaxyhack-1.74.ebuild   |  3 +-
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch 
b/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch
new file mode 100644
index 0000000..4bd9e8f
--- /dev/null
+++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch
@@ -0,0 +1,64 @@
+--- JSDL.cpp.old       2016-01-04 10:42:56.404316856 +0100
++++ JSDL.cpp   2016-01-04 10:51:16.744255312 +0100
+@@ -47,14 +47,14 @@
+       if (!globalSettings.batch) {
+               if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) {
+                       char output[120];
+-                      sprintf(output, SDL_GetError());
++                      strcpy(output, SDL_GetError());
+                       throw runtime_error(output);
+               }
+               
+               if (!globalSettings.disableSound) {
+                       if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) {
+                               char error[120];
+-                              sprintf(error, SDL_GetError());
++                              strcpy(error, SDL_GetError());
+                               string errorStr = error;
+                               errorStr += ", continuing without initialising 
sound.";
+                               WriteLog(errorStr);
+@@ -81,7 +81,7 @@
+               //4096 is rather a large chunksize, should be smaller if I add 
sound effects
+               if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 
4096) == -1) {
+                       char output[100];
+-                      sprintf(output, Mix_GetError());
++                      strcpy(output, Mix_GetError());
+                       throw runtime_error(output);
+               }
+       }
+@@ -101,7 +101,7 @@
+       if (screen == NULL) {
+               SDL_Quit();
+               char output[120];
+-              sprintf(output, SDL_GetError());
++              strcpy(output, SDL_GetError());
+               throw runtime_error(output);
+       }
+ }
+@@ -114,7 +114,7 @@
+ 
+       if (loadingSurface == NULL) {
+               char output[100];
+-              sprintf(output, IMG_GetError());
++              strcpy(output, IMG_GetError());
+               throw runtime_error(output);
+       }
+ 
+@@ -308,7 +308,7 @@
+ 
+       if (!theMusic) {
+               char output[100];
+-              sprintf(output, Mix_GetError());
++              strcpy(output, Mix_GetError());
+               throw runtime_error(output);
+       }
+ }
+@@ -319,7 +319,7 @@
+ 
+       if (Mix_PlayMusic(theMusic, -1) == -1) {
+               char output[100];
+-              sprintf(output, Mix_GetError());
++              strcpy(output, Mix_GetError());
+               throw runtime_error(output);
+       }
+ }

diff --git a/games-strategy/galaxyhack/galaxyhack-1.74.ebuild 
b/games-strategy/galaxyhack/galaxyhack-1.74.ebuild
index a85b755..f19966e 100644
--- a/games-strategy/galaxyhack/galaxyhack-1.74.ebuild
+++ b/games-strategy/galaxyhack/galaxyhack-1.74.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -30,6 +30,7 @@ src_prepare() {
                "${FILESDIR}"/${P}-boost.patch \
                "${FILESDIR}"/${P}-gcc43.patch \
                "${FILESDIR}"/${P}-boost-1.50.patch \
+               "${FILESDIR}"/${P}-format.patch \
                "${FILESDIR}"/${P}-gentoo.patch
        sed -i "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
                Main.cpp || die

Reply via email to