Blame SOURCES/0011-Fix-Wformat-security-issues.patch

5a929f
From 32ede3cc817ee4f6806877a34a6c84ed50c31df7 Mon Sep 17 00:00:00 2001
5a929f
From: Miroslav Grepl <mgrepl@redhat.com>
5a929f
Date: Fri, 11 Apr 2014 18:49:33 +0200
5a929f
Subject: [PATCH 11/11] Fix -Wformat-security issues
5a929f
5a929f
---
5a929f
 libseaudit/src/bool_message.c | 4 ++--
5a929f
 libseaudit/src/filter.c       | 2 +-
5a929f
 libseaudit/src/model.c        | 2 +-
5a929f
 seaudit/progress.c            | 4 ++--
5a929f
 seaudit/toplevel.c            | 2 +-
5a929f
 seaudit/utilgui.c             | 2 +-
5a929f
 sediff/progress.c             | 4 ++--
5a929f
 sediff/toplevel.c             | 2 +-
5a929f
 sediff/utilgui.c              | 2 +-
5a929f
 9 files changed, 12 insertions(+), 12 deletions(-)
5a929f
5a929f
diff --git a/libseaudit/src/bool_message.c b/libseaudit/src/bool_message.c
5a929f
index f105cf0..d5b1e33 100644
5a929f
--- a/libseaudit/src/bool_message.c
5a929f
+++ b/libseaudit/src/bool_message.c
5a929f
@@ -101,7 +101,7 @@ char *bool_message_to_string(const seaudit_message_t * msg, const char *date)
5a929f
 		return NULL;
5a929f
 	}
5a929f
 	if ((misc_string = bool_message_to_misc_string(boolm)) == NULL ||
5a929f
-	    apol_str_appendf(&s, &len, misc_string) < 0 || apol_str_append(&s, &len, close_brace) < 0) {
5a929f
+	    apol_str_appendf(&s, &len, "%s", misc_string) < 0 || apol_str_append(&s, &len, close_brace) < 0) {
5a929f
 		free(misc_string);
5a929f
 		return NULL;
5a929f
 	}
5a929f
@@ -128,7 +128,7 @@ char *bool_message_to_string_html(const seaudit_message_t * msg, const char *dat
5a929f
 		return NULL;
5a929f
 	}
5a929f
 	if ((misc_string = bool_message_to_misc_string(boolm)) == NULL ||
5a929f
-	    apol_str_appendf(&s, &len, misc_string) < 0 || apol_str_appendf(&s, &len, "%s%s
", s, close_brace) < 0) {
5a929f
+	    apol_str_appendf(&s, &len, "%s", misc_string) < 0 || apol_str_appendf(&s, &len, "%s%s
", s, close_brace) < 0) {
5a929f
 		free(misc_string);
5a929f
 		return NULL;
5a929f
 	}
5a929f
diff --git a/libseaudit/src/filter.c b/libseaudit/src/filter.c
5a929f
index 298a309..c710ce4 100644
5a929f
--- a/libseaudit/src/filter.c
5a929f
+++ b/libseaudit/src/filter.c
5a929f
@@ -1108,7 +1108,7 @@ int seaudit_filter_save_to_file(const seaudit_filter_t * filter, const char *fil
5a929f
 	if ((file = fopen(filename, "w")) == NULL) {
5a929f
 		return -1;
5a929f
 	}
5a929f
-	fprintf(file, XML_VER);
5a929f
+	fprintf(file, "%s", XML_VER);
5a929f
 	fprintf(file, "<view xmlns=\"http://oss.tresys.com/projects/setools/seaudit-%s/\">\n", FILTER_FILE_FORMAT_VERSION);
5a929f
 	filter_append_to_file(filter, file, 1);
5a929f
 	fprintf(file, "</view>\n");
5a929f
diff --git a/libseaudit/src/model.c b/libseaudit/src/model.c
5a929f
index 1bc4a23..4a130cb 100644
5a929f
--- a/libseaudit/src/model.c
5a929f
+++ b/libseaudit/src/model.c
5a929f
@@ -514,7 +514,7 @@ int seaudit_model_save_to_file(const seaudit_model_t * model, const char *filena
5a929f
 	if ((file = fopen(filename, "w")) == NULL) {
5a929f
 		return -1;
5a929f
 	}
5a929f
-	fprintf(file, XML_VER);
5a929f
+	fprintf(file, "%s", XML_VER);
5a929f
 	fprintf(file, "<view xmlns=\"http://oss.tresys.com/projects/setools/seaudit-%s/\" name=\"%s\" match=\"%s\" show=\"%s\">\n",
5a929f
 		FILTER_FILE_FORMAT_VERSION, model->name,
5a929f
 		model->match == SEAUDIT_FILTER_MATCH_ALL ? "all" : "any",
5a929f
diff --git a/seaudit/progress.c b/seaudit/progress.c
5a929f
index 2e0abeb..f092858 100644
5a929f
--- a/seaudit/progress.c
5a929f
+++ b/seaudit/progress.c
5a929f
@@ -114,10 +114,10 @@ int progress_wait(progress_t * progress)
5a929f
 	}
5a929f
 	g_mutex_unlock(progress->mutex);
5a929f
 	if (progress->done < 0) {
5a929f
-		toplevel_ERR(progress->top, GTK_LABEL(progress->label2)->label);
5a929f
+		toplevel_ERR(progress->top, "%s", GTK_LABEL(progress->label2)->label);
5a929f
 		return progress->done;
5a929f
 	} else if (progress->done > 1) {
5a929f
-		toplevel_WARN(progress->top, GTK_LABEL(progress->label2)->label);
5a929f
+		toplevel_WARN(progress->top, "%s", GTK_LABEL(progress->label2)->label);
5a929f
 		return progress->done - 1;
5a929f
 	} else {
5a929f
 		progress->done = 0;
5a929f
diff --git a/seaudit/toplevel.c b/seaudit/toplevel.c
5a929f
index d901a99..27938d5 100644
5a929f
--- a/seaudit/toplevel.c
5a929f
+++ b/seaudit/toplevel.c
5a929f
@@ -902,7 +902,7 @@ static void toplevel_message(toplevel_t * top, GtkMessageType msg_type, const ch
5a929f
 		ERR(NULL, "%s", strerror(errno));
5a929f
 		return;
5a929f
 	}
5a929f
-	dialog = gtk_message_dialog_new(top->w, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, msg);
5a929f
+	dialog = gtk_message_dialog_new(top->w, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, "%s", msg);
5a929f
 	free(msg);
5a929f
 	gtk_dialog_run(GTK_DIALOG(dialog));
5a929f
 	gtk_widget_destroy(dialog);
5a929f
diff --git a/seaudit/utilgui.c b/seaudit/utilgui.c
5a929f
index 22028e1..78a1a08 100644
5a929f
--- a/seaudit/utilgui.c
5a929f
+++ b/seaudit/utilgui.c
5a929f
@@ -30,7 +30,7 @@
5a929f
 void util_message(GtkWindow * parent, GtkMessageType msg_type, const char *msg)
5a929f
 {
5a929f
 	GtkWidget *dialog;
5a929f
-	dialog = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, msg);
5a929f
+	dialog = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, "%s", msg);
5a929f
 	gtk_dialog_run(GTK_DIALOG(dialog));
5a929f
 	gtk_widget_destroy(dialog);
5a929f
 }
5a929f
diff --git a/sediff/progress.c b/sediff/progress.c
5a929f
index efaa120..312789e 100644
5a929f
--- a/sediff/progress.c
5a929f
+++ b/sediff/progress.c
5a929f
@@ -115,10 +115,10 @@ int progress_wait(progress_t * progress)
5a929f
 	}
5a929f
 	g_mutex_unlock(progress->mutex);
5a929f
 	if (progress->done < 0) {
5a929f
-		toplevel_ERR(progress->top, GTK_LABEL(progress->label2)->label);
5a929f
+		toplevel_ERR(progress->top, "%s", GTK_LABEL(progress->label2)->label);
5a929f
 		return progress->done;
5a929f
 	} else if (progress->done > 1) {
5a929f
-		toplevel_WARN(progress->top, GTK_LABEL(progress->label2)->label);
5a929f
+		toplevel_WARN(progress->top, "%s", GTK_LABEL(progress->label2)->label);
5a929f
 		return progress->done - 1;
5a929f
 	} else {
5a929f
 		progress->done = 0;
5a929f
diff --git a/sediff/toplevel.c b/sediff/toplevel.c
5a929f
index db6d1f5..aabd039 100644
5a929f
--- a/sediff/toplevel.c
5a929f
+++ b/sediff/toplevel.c
5a929f
@@ -453,7 +453,7 @@ static void toplevel_message(toplevel_t * top, GtkMessageType msg_type, const ch
5a929f
 		ERR(NULL, "%s", strerror(errno));
5a929f
 		return;
5a929f
 	}
5a929f
-	dialog = gtk_message_dialog_new(top->w, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, msg);
5a929f
+	dialog = gtk_message_dialog_new(top->w, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, "%s", msg);
5a929f
 	free(msg);
5a929f
 	gtk_dialog_run(GTK_DIALOG(dialog));
5a929f
 	gtk_widget_destroy(dialog);
5a929f
diff --git a/sediff/utilgui.c b/sediff/utilgui.c
5a929f
index 04e1e05..9e183ba 100644
5a929f
--- a/sediff/utilgui.c
5a929f
+++ b/sediff/utilgui.c
5a929f
@@ -31,7 +31,7 @@
5a929f
 void util_message(GtkWindow * parent, GtkMessageType msg_type, const char *msg)
5a929f
 {
5a929f
 	GtkWidget *dialog;
5a929f
-	dialog = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, msg);
5a929f
+	dialog = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT, msg_type, GTK_BUTTONS_CLOSE, "%s", msg);
5a929f
 	gtk_dialog_run(GTK_DIALOG(dialog));
5a929f
 	gtk_widget_destroy(dialog);
5a929f
 }
5a929f
-- 
5a929f
1.8.5.3
5a929f