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