[gtranslator] Patch by Atilla Öntas



commit 67808854ebefe2efa57732982ec01228f9bb7b0b
Author: Pablo Sanxiao <psanxiao gmail com>
Date:   Sun Apr 26 15:49:25 2009 -0700

    	Patch by Atilla Ã?ntas
    
    	* plugins/alternate-language/alternate-language-panel.c:
    	* plugins/dictionary/dict-panel.c:
    	* plugins/fullscreen/fullscreen-plugin.c:
    	* plugins/open-tran/open-tran-panel.c:
    	* plugins/source-code-view/viewer.c:
    	* plugins/subversion/commit-dialog.c:
    	* plugins/subversion/diff-dialog.c:
    	* plugins/subversion/subversion-plugin.c:
    	* plugins/subversion/subversion-utils.c:
    	* src/actions-file.c:
    	* src/plugin-system/module.c:
    	* src/plugin-system/plugins-engine.c:
    	* src/tab.c:
    	* src/translation-memory/berkeley/db-base.c:
    	* src/utils.c:
    	* src/view.c:
    	Fixed format string attack. (Fix bug #579775)
---
 .../alternate-language/alternate-language-panel.c  |    2 +-
 plugins/dictionary/dict-panel.c                    |   16 ++++++++--------
 plugins/fullscreen/fullscreen-plugin.c             |    2 +-
 plugins/open-tran/open-tran-panel.c                |    4 ++--
 plugins/source-code-view/viewer.c                  |    2 +-
 plugins/subversion/commit-dialog.c                 |    6 +++---
 plugins/subversion/diff-dialog.c                   |   12 ++++++------
 plugins/subversion/subversion-plugin.c             |    2 +-
 plugins/subversion/subversion-utils.c              |    8 ++++----
 src/actions-file.c                                 |    8 ++++----
 src/plugin-system/module.c                         |    4 ++--
 src/plugin-system/plugins-engine.c                 |    2 +-
 src/tab.c                                          |    2 +-
 src/translation-memory/berkeley/db-base.c          |    4 ++--
 src/utils.c                                        |    2 +-
 src/view.c                                         |    2 +-
 16 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/plugins/alternate-language/alternate-language-panel.c b/plugins/alternate-language/alternate-language-panel.c
index 3091972..c19fc08 100644
--- a/plugins/alternate-language/alternate-language-panel.c
+++ b/plugins/alternate-language/alternate-language-panel.c
@@ -163,7 +163,7 @@ open_file (GtkWidget *dialog,
 						   GTK_DIALOG_DESTROY_WITH_PARENT,
 						   GTK_MESSAGE_ERROR,
 						   GTK_BUTTONS_CLOSE,
-						   error->message);
+						   "%s", error->message);
 		gtk_dialog_run (GTK_DIALOG (erdialog));
 		gtk_widget_destroy (erdialog);
 		g_error_free (error);
diff --git a/plugins/dictionary/dict-panel.c b/plugins/dictionary/dict-panel.c
index c65b65b..a037d6e 100644
--- a/plugins/dictionary/dict-panel.c
+++ b/plugins/dictionary/dict-panel.c
@@ -94,11 +94,11 @@ gtranslator_dict_panel_create_warning_dialog (const gchar *primary,
 					 GTK_DIALOG_DESTROY_WITH_PARENT,
 					 GTK_MESSAGE_WARNING,
 					 GTK_BUTTONS_CLOSE,
-					 primary);
+					 "%s", primary);
 	
 	if (secondary)
 		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-							  secondary);
+							  "%s", secondary);
 	gtk_dialog_run (GTK_DIALOG (dialog));
 	gtk_widget_destroy (dialog);
 }
@@ -289,7 +289,7 @@ source_activated_cb (GdictSourceChooser *chooser,
 		
 		message = g_strdup_printf (_("Dictionary source '%s' selected"),
 					   gdict_source_get_description (source));
-		gtranslator_statusbar_flash_message (panel->priv->status, 0, message);
+		gtranslator_statusbar_flash_message ("%s", panel->priv->status, 0, message);
 		g_free (message);
 	}
 }
@@ -308,7 +308,7 @@ strategy_activated_cb (GdictStrategyChooser *chooser,
 		gchar *message;
 		
 		message = g_strdup_printf (_("Strategy '%s' selected"), strat_desc);
-		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		gtranslator_statusbar_flash_message ("%s", priv->status, 0, message);
 		g_free (message);
 	}
 }
@@ -327,7 +327,7 @@ database_activated_cb (GdictDatabaseChooser *chooser,
 		gchar *message;
 		
 		message = g_strdup_printf (_("Database '%s' selected"), db_desc);
-		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		gtranslator_statusbar_flash_message ("%s", priv->status, 0, message);
 		g_free (message);
 	}
 }
@@ -373,7 +373,7 @@ speller_word_activated_cb (GdictSpeller *speller,
 		gchar *message;
 		
 		message = g_strdup_printf (_("Word '%s' selected"), word);
-		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		gtranslator_statusbar_flash_message ("%s", priv->status, 0, message);
 		g_free (message);
 	}
 }
@@ -425,7 +425,7 @@ sidebar_page_changed_cb (GdictSidebar *sidebar,
 	}
 	
 	if (message && priv->status)
-		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		gtranslator_statusbar_flash_message ("%s", priv->status, 0, message);
 }
 
 static void
@@ -723,4 +723,4 @@ gtranslator_dict_panel_new (GtranslatorWindow *window)
 	panel->priv->status = GTR_STATUSBAR (gtranslator_window_get_statusbar (window));
 	
 	return GTK_WIDGET (panel);
-}
\ No newline at end of file
+}
diff --git a/plugins/fullscreen/fullscreen-plugin.c b/plugins/fullscreen/fullscreen-plugin.c
index 07dcd49..ce705a0 100644
--- a/plugins/fullscreen/fullscreen-plugin.c
+++ b/plugins/fullscreen/fullscreen-plugin.c
@@ -101,7 +101,7 @@ impl_activate (GtranslatorPlugin *plugin,
 	
 	if (data->ui_id == 0)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		g_free (data);
 		return;
diff --git a/plugins/open-tran/open-tran-panel.c b/plugins/open-tran/open-tran-panel.c
index b8bc338..d97e249 100644
--- a/plugins/open-tran/open-tran-panel.c
+++ b/plugins/open-tran/open-tran-panel.c
@@ -90,7 +90,7 @@ show_error_dialog (GtranslatorWindow *parent,
 				       GTK_DIALOG_DESTROY_WITH_PARENT,
 				       GTK_MESSAGE_ERROR,
 				       GTK_BUTTONS_CLOSE,
-				       msg);
+				       "%s", msg);
 	g_free(msg);
 	
 	g_signal_connect(dialog, "response",
@@ -241,7 +241,7 @@ open_connection(GtranslatorOpenTranPanel *panel,
 	array = soup_value_array_new_with_vals (G_TYPE_STRING, text,
 						G_TYPE_STRING, search_code,
 						G_TYPE_STRING, own_code,
-						G_TYPE_INVALID);
+						"%s", G_TYPE_INVALID);
 	
 	body = soup_xmlrpc_build_method_call ("suggest2", array->values,
 					      array->n_values);
diff --git a/plugins/source-code-view/viewer.c b/plugins/source-code-view/viewer.c
index 06403dd..8d50e91 100644
--- a/plugins/source-code-view/viewer.c
+++ b/plugins/source-code-view/viewer.c
@@ -169,7 +169,7 @@ error_dialog (GtkWindow *parent, const gchar *msg, ...)
 					 GTK_DIALOG_DESTROY_WITH_PARENT,
 					 GTK_MESSAGE_ERROR,
 					 GTK_BUTTONS_OK,
-					 tmp);
+					 "%s", tmp);
 	g_free (tmp);
 
 	gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/plugins/subversion/commit-dialog.c b/plugins/subversion/commit-dialog.c
index aeaf3e2..95f796a 100644
--- a/plugins/subversion/commit-dialog.c
+++ b/plugins/subversion/commit-dialog.c
@@ -246,7 +246,7 @@ on_command_info_arrived (GtranslatorCommand *command,
 	{
 		message = g_queue_pop_head (info);
 		gtranslator_statusbar_flash_message (status, 0,
-						     message);
+						     "%s", message);
 		g_free (message);
 	}
 }
@@ -306,7 +306,7 @@ add_changelog_entry (GtranslatorCommitDialog *dlg)
 	
 	if (tmpfd == -1)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		g_object_unref (changelog_file);
 		
@@ -373,7 +373,7 @@ add_changelog_entry (GtranslatorCommitDialog *dlg)
 	
 free:   if (error)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 	g_object_unref (tmp_file);
diff --git a/plugins/subversion/diff-dialog.c b/plugins/subversion/diff-dialog.c
index 81b4b3b..1abfb5d 100644
--- a/plugins/subversion/diff-dialog.c
+++ b/plugins/subversion/diff-dialog.c
@@ -157,7 +157,7 @@ on_cat_command_info_arrived (GtranslatorCommand *command,
 	
 	if (tmpfd == -1)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		
 		/* In this case we don't have to close the file */
@@ -185,14 +185,14 @@ on_cat_command_info_arrived (GtranslatorCommand *command,
 	
 	if (error)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		error = NULL;
 	}
 	
 	if (!g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, &error))
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 	
@@ -245,7 +245,7 @@ on_diff_command_info_arrived (GtranslatorCommand *command,
 	{
 		if (!g_file_delete (tmp_file, NULL, &error))
 		{
-			g_warning (error->message);
+			g_warning ("%s", error->message);
 			g_error_free (error);
 			
 			g_object_unref (tmp_file);
@@ -272,14 +272,14 @@ on_diff_command_info_arrived (GtranslatorCommand *command,
 	
 	if (error)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		error = NULL;
 	}
 	
 	if (!g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, &error))
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 	
diff --git a/plugins/subversion/subversion-plugin.c b/plugins/subversion/subversion-plugin.c
index 44bc082..c8f4dec 100644
--- a/plugins/subversion/subversion-plugin.c
+++ b/plugins/subversion/subversion-plugin.c
@@ -285,7 +285,7 @@ impl_activate (GtranslatorPlugin *plugin,
 	
 	if (data->ui_id == 0)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		return;
 	}
diff --git a/plugins/subversion/subversion-utils.c b/plugins/subversion/subversion-utils.c
index c9547a4..9e7698b 100644
--- a/plugins/subversion/subversion-utils.c
+++ b/plugins/subversion/subversion-utils.c
@@ -55,7 +55,7 @@ subversion_utils_report_errors (GtranslatorWindow *window,
 						 GTK_DIALOG_DESTROY_WITH_PARENT,
 						 GTK_MESSAGE_ERROR,
 						 GTK_BUTTONS_CLOSE,
-						 message);
+						 "%s", message);
 		g_free (message);
 		
 		gtk_dialog_run (GTK_DIALOG (dialog));
@@ -119,20 +119,20 @@ subversion_utils_from_file_to_file (GInputStream *istream,
 	
 	if (error)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		error = NULL;
 	}
 	
 	if (!g_output_stream_close (ostream, NULL, &error))
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		error = NULL;
 	}
 	if (!g_input_stream_close (istream, NULL, &error))
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 }
diff --git a/src/actions-file.c b/src/actions-file.c
index 21ee926..28815c9 100644
--- a/src/actions-file.c
+++ b/src/actions-file.c
@@ -261,7 +261,7 @@ save_dialog_response_cb (GtkDialog *dialog,
 							 GTK_DIALOG_DESTROY_WITH_PARENT,
 							 GTK_MESSAGE_WARNING,
 							 GTK_BUTTONS_OK,
-							 error->message);
+							 "%s", error->message);
 			gtk_dialog_run(GTK_DIALOG(dialog));
 			gtk_widget_destroy(dialog);
 			g_clear_error(&error);
@@ -388,7 +388,7 @@ gtranslator_save_current_file_dialog (GtkWidget * widget,
 						 GTK_DIALOG_DESTROY_WITH_PARENT,
 						 GTK_MESSAGE_WARNING,
 						 GTK_BUTTONS_OK,
-						 error->message);
+						 "%s", error->message);
 		gtk_dialog_run(GTK_DIALOG(dialog));
 		gtk_widget_destroy(dialog);
 		g_clear_error(&error);
@@ -485,7 +485,7 @@ load_file_list (GtranslatorWindow *window,
 						GTK_DIALOG_DESTROY_WITH_PARENT,
 						GTK_MESSAGE_ERROR,
 						GTK_BUTTONS_CLOSE,
-						error->message);
+						"%s", error->message);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
 		g_error_free(error);
@@ -564,7 +564,7 @@ save_and_close_all_documents (GList *unsaved_documents,
 							 GTK_DIALOG_DESTROY_WITH_PARENT,
 							 GTK_MESSAGE_WARNING,
 							 GTK_BUTTONS_OK,
-							 error->message);
+							 "%s", error->message);
 			gtk_dialog_run (GTK_DIALOG (dialog));
 			gtk_widget_destroy (dialog);
 			g_clear_error (&error);
diff --git a/src/plugin-system/module.c b/src/plugin-system/module.c
index 928943a..7a0e19b 100644
--- a/src/plugin-system/module.c
+++ b/src/plugin-system/module.c
@@ -70,7 +70,7 @@ gtranslator_module_load (GTypeModule *gmodule)
 
 	if (module->library == NULL)
 	{
-		g_warning (g_module_error());
+		g_warning ("%s", g_module_error());
 
 		return FALSE;
 	}
@@ -79,7 +79,7 @@ gtranslator_module_load (GTypeModule *gmodule)
 	if (!g_module_symbol (module->library, "register_gtranslator_plugin",
 			      (void *) &register_func))
 	{
-		g_warning (g_module_error());
+		g_warning ("%s", g_module_error());
 		g_module_close (module->library);
 
 		return FALSE;
diff --git a/src/plugin-system/plugins-engine.c b/src/plugin-system/plugins-engine.c
index 308c02d..b8dd922 100644
--- a/src/plugin-system/plugins-engine.c
+++ b/src/plugin-system/plugins-engine.c
@@ -101,7 +101,7 @@ gtranslator_plugins_engine_load_dir (GtranslatorPluginsEngine *engine,
 	d = g_dir_open (dir, 0, &error);
 	if (!d)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		return;
 	}
diff --git a/src/tab.c b/src/tab.c
index 7bab802..6850093 100644
--- a/src/tab.c
+++ b/src/tab.c
@@ -172,7 +172,7 @@ gtranslator_tab_autosave (GtranslatorTab *tab)
 	gtranslator_po_save_file (tab->priv->po, &error);
 	if (error)
 	{
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 	
diff --git a/src/translation-memory/berkeley/db-base.c b/src/translation-memory/berkeley/db-base.c
index b3c6054..3474741 100644
--- a/src/translation-memory/berkeley/db-base.c
+++ b/src/translation-memory/berkeley/db-base.c
@@ -173,7 +173,7 @@ gtranslator_db_base_show_error (GtranslatorDbBase *base,
 				err = g_strdup_printf (_("There was an error recovering the database: %s"),
 						       db_strerror (e));
 				
-				g_warning (err);
+				g_warning ("%s", err);
 				g_free (err);
 			}
 			break;
@@ -181,7 +181,7 @@ gtranslator_db_base_show_error (GtranslatorDbBase *base,
 			err = g_strdup_printf (_("There was an error in database: %s"),
 					       db_strerror (error));
 			
-			g_warning (err);
+			g_warning ("%s", err);
 			g_free (err);
 			break;
 	}
diff --git a/src/utils.c b/src/utils.c
index b951fcb..fa13ce9 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -944,7 +944,7 @@ gtranslator_utils_scan_dir (GFile *dir,
 		
 		if (error)
 		{
-			g_warning (error->message);
+			g_warning ("%s", error->message);
 		}
 	}
 }
diff --git a/src/view.c b/src/view.c
index 7c6cb00..b2832ee 100644
--- a/src/view.c
+++ b/src/view.c
@@ -81,7 +81,7 @@ gtranslator_attach_gtkspell(GtranslatorView *view)
 		g_warning(_("gtkspell error: %s\n"), error->message);
 		errortext = g_strdup_printf(_("GtkSpell was unable to initialize.\n %s"),
 					    error->message);
-		g_warning(errortext);
+		g_warning("%s", errortext);
 		
 		g_error_free(error);
 		g_free(errortext);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]