From a489f3678d5e037f44d4aa1e02b7eb30c9097666 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Tue, 13 Dec 2022 00:22:04 +0100
Subject: [PATCH 1/1] fix format-security error from gcc

Building with `-Werror=format-security` causes several of these errors:

error: format not a string literal and no format arguments [-Werror=format-security]

Let's fix by giving a proper format string.
---
 src/dialog.c   | 4 ++--
 src/gtkprint.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/dialog.c b/src/dialog.c
index 14b69d7..5c4fe82 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -36,7 +36,7 @@ void run_dialog_message(GtkWidget *window,
 		GTK_DIALOG_DESTROY_WITH_PARENT,
 		type,
 		GTK_BUTTONS_NONE,
-		str);
+		"%s", str);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 	gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 		GTK_STOCK_OK, GTK_RESPONSE_CANCEL, NULL);
@@ -61,7 +61,7 @@ GtkWidget *create_dialog_message_question(GtkWidget *window, gchar *message, ...
 		GTK_DIALOG_DESTROY_WITH_PARENT,
 		GTK_MESSAGE_QUESTION,
 		GTK_BUTTONS_NONE,
-		str);
+		"%s", str);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 	gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 		GTK_STOCK_NO, GTK_RESPONSE_NO,
diff --git a/src/gtkprint.c b/src/gtkprint.c
index 3f39384..75e2f68 100644
--- a/src/gtkprint.c
+++ b/src/gtkprint.c
@@ -165,7 +165,7 @@ static void create_error_dialog(GtkTextView *text_view, gchar *message)
 		GTK_DIALOG_DESTROY_WITH_PARENT,
 		GTK_MESSAGE_ERROR,
 		GTK_BUTTONS_NONE,
-		message);
+		"%s", message);
 	gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 	gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 		GTK_STOCK_OK, GTK_RESPONSE_CANCEL, NULL);
-- 
2.39.0

