diff --git a/recipes-emulators/dosbox/dosbox-x.bb b/recipes-emulators/dosbox/dosbox-x.bb index c850c9b..c064f52 100644 --- a/recipes-emulators/dosbox/dosbox-x.bb +++ b/recipes-emulators/dosbox/dosbox-x.bb @@ -23,6 +23,7 @@ SRC_URI = " \ file://0001-use-pkgconfig-to-find-sdl2.patch \ file://0002-Enable-unaligned-memory-based-on-recipe-s-suggestion.patch \ file://0003-Treat-all-arm-hosts-as-armv7.patch \ + file://0004-Fix-build-with-Werror-format-security.patch \ " SRCREV = "d9f66b9635b062aaed0a704c7c6a600e0a7e7930" PV = "0.83.9" diff --git a/recipes-emulators/dosbox/dosbox-x/0004-Fix-build-with-Werror-format-security.patch b/recipes-emulators/dosbox/dosbox-x/0004-Fix-build-with-Werror-format-security.patch new file mode 100644 index 0000000..ed4d59b --- /dev/null +++ b/recipes-emulators/dosbox/dosbox-x/0004-Fix-build-with-Werror-format-security.patch @@ -0,0 +1,74 @@ +From fe1c3225134be9523208945ab4ea20315bb4dad1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Sat, 2 Jan 2021 16:02:09 +0100 +Subject: [PATCH] Fix build with -Werror=format-security +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some build environments harden their security flags. For +-Werror=format-security build failed with: + +| sdl_ttf.c:334:18: error: format not a string literal and no format arguments [-Werror=format-security] +| 334 | TTF_SetError(msg); +| | ^ + +and + +| sdl_ttf.c:534:30: error: format not a string literal and no format arguments [-Werror=format-security] +| 534 | TTF_SetError(SDL_GetError()); +| | ^ + +While at it fix/simpify code path with defined USE_FREETYPE_ERRORS + +Upstream-Status: Submitted [https://github.com/joncampbell123/dosbox-x/pull/2146] + +Signed-off-by: Andreas Müller +--- + src/gui/sdl_ttf.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/src/gui/sdl_ttf.c b/src/gui/sdl_ttf.c +index de6c829b7..b33e06013 100644 +--- a/src/gui/sdl_ttf.c ++++ b/src/gui/sdl_ttf.c +@@ -316,7 +316,6 @@ static void TTF_SetFTError(const char *msg, FT_Error error) + }; + int i; + const char *err_msg; +- char buffer[1024]; + + err_msg = NULL; + for ( i=0; i<((sizeof ft_errors)/(sizeof ft_errors[0])); ++i ) { +@@ -328,10 +327,9 @@ static void TTF_SetFTError(const char *msg, FT_Error error) + if ( ! err_msg ) { + err_msg = "unknown FreeType error"; + } +- sprintf(buffer, "%s: %s", msg, err_msg); +- TTF_SetError(buffer); ++ TTF_SetError("%s: %s", msg, err_msg); + #else +- TTF_SetError(msg); ++ TTF_SetError("%s", msg); + #endif /* USE_FREETYPE_ERRORS */ + } + +@@ -533,7 +531,7 @@ TTF_Font* TTF_OpenFontIndex( const char *file, int ptsize, long index ) + { + SDL_RWops *rw = SDL_RWFromFile(file, "rb"); + if ( rw == NULL ) { +- TTF_SetError(SDL_GetError()); ++ TTF_SetError("%s", SDL_GetError()); + return NULL; + } + return TTF_OpenFontIndexRW(rw, 1, ptsize, index); +@@ -2101,4 +2099,4 @@ int TTF_GetFontKerningSize(TTF_Font* font, int prev_index, int index) + FT_Vector delta; + FT_Get_Kerning( font->face, prev_index, index, ft_kerning_default, &delta ); + return (delta.x >> 6); +-} +\ No newline at end of file ++} +-- +2.26.2 +