From f60d2a2964d08ec24625eb0a7e11a137dd3791cd Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Sun, 5 Dec 2021 15:50:20 +0100 Subject: [PATCH] Fix -Wformat-security warnings These warnings are kinda spammy, and they make sense in principle. vlog_error takes a format string, so passing it an arbitrary string (even error messages from libraries) isn't a good idea. --- desktop_version/src/FileSystemUtils.cpp | 2 +- desktop_version/src/Graphics.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 25f2acda..265a7370 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -306,7 +306,7 @@ static int setLevelDirError(const char* text, ...) retval = SDL_vsnprintf(levelDirError, sizeof(levelDirError), text, list); va_end(list); - vlog_error(levelDirError); + vlog_error("%s", levelDirError); return retval; } diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 30c76d41..42dcc196 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -321,7 +321,7 @@ void Graphics::updatetitlecolours(void) SDL_snprintf(error, sizeof(error), error_fmt, #tilesheet, tile_square); \ SDL_snprintf(error_title, sizeof(error_title), error_title_fmt, #tilesheet); \ \ - vlog_error(error); \ + vlog_error("%s", error); \ \ return false; \ }