From 83cff1f59a0c5e2d2634eae3701c8b04d2a98ac7 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 5 Nov 2024 13:26:17 +0200 Subject: [PATCH] Fix build regression with -Wformat-security Commit 547ba089313be46861fe1f5b21fbe887205697c2 broke the build with -Wformat-security. Add the trivial fix and ensure it stays that way by adding -Wformat-security to our normal build flags. --- CMakeLists.txt | 2 +- rpmio/rpmlog.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2a820b267..923265171b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -399,7 +399,7 @@ configure_file(config.h.in config.h) add_compile_definitions(HAVE_CONFIG_H) -add_compile_options(-Wall -Wpointer-arith -Wempty-body) +add_compile_options(-Wall -Wpointer-arith -Wempty-body -Wformat-security) if (ENABLE_WERROR) add_compile_options(-Werror) endif() diff --git a/rpmio/rpmlog.cc b/rpmio/rpmlog.cc index fdbbed8e5a..b3a28062b6 100644 --- a/rpmio/rpmlog.cc +++ b/rpmio/rpmlog.cc @@ -443,7 +443,7 @@ int rpmlogOnce (uint64_t domain, const char * key, int code, const char *fmt, .. char *msg = NULL; va_start(ap, fmt); if (rvasprintf(&msg, fmt, ap) >= 0) { - rpmlog(code, msg); + rpmlog(code, "%s", msg); free(msg); } va_end(ap);