Skip to content

Commit

Permalink
games-strategy/galaxyhack: Build with -Wformat-security. Bug #57069
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.24
  • Loading branch information
atupone committed Jan 4, 2016
1 parent 7692db7 commit f2c4d6d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
64 changes: 64 additions & 0 deletions games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch
Original file line number Diff line number Diff line change
@@ -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);
}
}
3 changes: 2 additions & 1 deletion games-strategy/galaxyhack/galaxyhack-1.74.ebuild
Original file line number Diff line number Diff line change
@@ -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$

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f2c4d6d

Please sign in to comment.