2007-08-30 [colin] 2.10.0cvs185
authorColin Leroy <colin@colino.net>
Thu, 30 Aug 2007 16:12:14 +0000 (16:12 +0000)
committerColin Leroy <colin@colino.net>
Thu, 30 Aug 2007 16:12:14 +0000 (16:12 +0000)
* src/compose.c
* src/folderview.c
* src/main.c
* src/prefs_matcher.c
* src/prefs_template.c
* src/quote_fmt.c
* src/send_message.c
* src/toolbar.c
* src/gtk/gtkaspell.c
* src/plugins/bogofilter/bogofilter.c
* src/plugins/bogofilter/bogofilter_gtk.c
* src/plugins/clamav/clamav_plugin_gtk.c
* src/plugins/pgpcore/sgpgme.c
* src/plugins/spamassassin/spamassassin.c
* src/plugins/spamassassin/spamassassin_gtk.c
Fix all potential misuses of format-string functions

18 files changed:
ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/folderview.c
src/gtk/gtkaspell.c
src/main.c
src/plugins/bogofilter/bogofilter.c
src/plugins/bogofilter/bogofilter_gtk.c
src/plugins/clamav/clamav_plugin_gtk.c
src/plugins/pgpcore/sgpgme.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin_gtk.c
src/prefs_matcher.c
src/prefs_template.c
src/quote_fmt.c
src/send_message.c
src/toolbar.c

index e0ed8cb..692d42d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-08-30 [colin]     2.10.0cvs185
+
+       * src/compose.c
+       * src/folderview.c
+       * src/main.c
+       * src/prefs_matcher.c
+       * src/prefs_template.c
+       * src/quote_fmt.c
+       * src/send_message.c
+       * src/toolbar.c
+       * src/gtk/gtkaspell.c
+       * src/plugins/bogofilter/bogofilter.c
+       * src/plugins/bogofilter/bogofilter_gtk.c
+       * src/plugins/clamav/clamav_plugin_gtk.c
+       * src/plugins/pgpcore/sgpgme.c
+       * src/plugins/spamassassin/spamassassin.c
+       * src/plugins/spamassassin/spamassassin_gtk.c
+               Fix all potential misuses of format-string functions
+
 2007-08-30 [wwp]       2.10.0cvs184
 
        * src/prefs_template.c
index 8f35390..5ca56e1 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.207 -r 1.274.2.208 src/mainwindow.c;  ) > 2.10.0cvs182.patchset
 ( cvs diff -u -r 1.14.2.58 -r 1.14.2.59 src/plugins/trayicon/trayicon.c;  ) > 2.10.0cvs183.patchset
 ( cvs diff -u -r 1.12.2.45 -r 1.12.2.46 src/prefs_template.c;  ) > 2.10.0cvs184.patchset
+( cvs diff -u -r 1.382.2.404 -r 1.382.2.405 src/compose.c;  cvs diff -u -r 1.207.2.178 -r 1.207.2.179 src/folderview.c;  cvs diff -u -r 1.115.2.164 -r 1.115.2.165 src/main.c;  cvs diff -u -r 1.43.2.61 -r 1.43.2.62 src/prefs_matcher.c;  cvs diff -u -r 1.12.2.46 -r 1.12.2.47 src/prefs_template.c;  cvs diff -u -r 1.8.2.22 -r 1.8.2.23 src/quote_fmt.c;  cvs diff -u -r 1.17.2.42 -r 1.17.2.43 src/send_message.c;  cvs diff -u -r 1.43.2.81 -r 1.43.2.82 src/toolbar.c;  cvs diff -u -r 1.9.2.53 -r 1.9.2.54 src/gtk/gtkaspell.c;  cvs diff -u -r 1.1.2.33 -r 1.1.2.34 src/plugins/bogofilter/bogofilter.c;  cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/plugins/bogofilter/bogofilter_gtk.c;  cvs diff -u -r 1.9.2.26 -r 1.9.2.27 src/plugins/clamav/clamav_plugin_gtk.c;  cvs diff -u -r 1.1.2.47 -r 1.1.2.48 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.18.2.55 -r 1.18.2.56 src/plugins/spamassassin/spamassassin.c;  cvs diff -u -r 1.23.2.40 -r 1.23.2.41 src/plugins/spamassassin/spamassassin_gtk.c;  ) > 2.10.0cvs185.patchset
index ac1dd81..02c0f4c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=184
+EXTRA_VERSION=185
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0a43af9..7e52447 100644 (file)
@@ -2671,9 +2671,7 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
                buf = quote_fmt_get_buffer();
                if (buf == NULL) {
                        gint line = quote_fmt_get_line();
-                       gchar *msg = g_strdup_printf(err_msg, line);
-                       alertpanel_error(msg);
-                       g_free(msg);
+                       alertpanel_error(err_msg, line);
                        goto error;
                }
        } else
@@ -4615,11 +4613,9 @@ gint compose_send(Compose *compose)
                }
        } else {
                if (errstr) {
-                       gchar *tmp = g_strdup_printf(_("%s\nUse \"Send queued messages\" from "
+                       alertpanel_error_log(_("%s\nUse \"Send queued messages\" from "
                                   "the main window to retry."), errstr);
                        g_free(errstr);
-                       alertpanel_error_log(tmp);
-                       g_free(tmp);
                } else {
                        alertpanel_error_log(_("The message was queued but could not be "
                                   "sent.\nUse \"Send queued messages\" from "
@@ -7061,12 +7057,9 @@ static void compose_update_privacy_system_menu_item(Compose * compose, gboolean
                        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
                
                if (warn && !found && strlen(compose->privacy_system)) {
-                       gchar *tmp = g_strdup_printf(
-                               _("The privacy system '%s' cannot be loaded. You "
+                       alertpanel_warning(_("The privacy system '%s' cannot be loaded. You "
                                  "will not be able to sign or encrypt this message."),
                                  compose->privacy_system);
-                       alertpanel_warning(tmp);
-                       g_free(tmp);
                }
        } 
 
index 427228b..4e54889 100644 (file)
@@ -2440,11 +2440,9 @@ static void folderview_send_queue_cb(FolderView *folderview, guint action,
                        alertpanel_error_log(_("Some errors occurred while "
                                           "sending queued messages."));
                else {
-                       gchar *tmp = g_strdup_printf(_("Some errors occurred "
+                       alertpanel_error_log(_("Some errors occurred "
                                        "while sending queued messages:\n%s"), errstr);
                        g_free(errstr);
-                       alertpanel_error_log(tmp);
-                       g_free(tmp);
                }
        }
 }
index 33c47c3..698d14d 100644 (file)
@@ -2318,12 +2318,8 @@ gboolean gtkaspell_change_dict(GtkAspell *gtkaspell, const gchar *dictionary,
        gtkaspeller = gtkaspeller_new(dict);
 
        if (!gtkaspeller) {
-               gchar *message;
-               message = g_strdup_printf(_("The spell checker could not change dictionary.\n%s"), 
+               alertpanel_warning(_("The spell checker could not change dictionary.\n%s"), 
                                          gtkaspellcheckers->error_message);
-
-               alertpanel_warning(message); 
-               g_free(message);
        } else {
                if (gtkaspell->use_alternate) {
                        if (gtkaspell->alternate_speller) {
@@ -2364,12 +2360,8 @@ gboolean gtkaspell_change_alt_dict(GtkAspell *gtkaspell, const gchar *alt_dictio
        gtkaspeller = gtkaspeller_new(dict);
 
        if (!gtkaspeller) {
-               gchar *message;
-               message = g_strdup_printf(_("The spell checker could not change the alternate dictionary.\n%s"), 
+               alertpanel_warning(_("The spell checker could not change the alternate dictionary.\n%s"), 
                                          gtkaspellcheckers->error_message);
-
-               alertpanel_warning(message); 
-               g_free(message);
        } else {
                if (gtkaspell->alternate_speller)
                        gtkaspeller_delete(gtkaspell->alternate_speller);
index b60e746..02335bb 100644 (file)
@@ -1999,11 +1999,9 @@ static void send_queue(void)
                }
        }
        if (errstr) {
-               gchar *tmp = g_strdup_printf(_("Some errors occurred "
+               alertpanel_error_log(_("Some errors occurred "
                                "while sending queued messages:\n%s"), errstr);
                g_free(errstr);
-               alertpanel_error_log(tmp);
-               g_free(tmp);
        } else if (error) {
                alertpanel_error_log("Some errors occurred "
                                "while sending queued messages.");
index 64eca15..e9af909 100644 (file)
@@ -572,13 +572,11 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
                                           bogo_args[0], bogo_args[1], bogo_args[2]);
                if (!prefs_common.no_recv_err_panel) {
                        if (!warned_error) {
-                               alertpanel_error(msg);
+                               alertpanel_error("%s", msg);
                        }
                        warned_error = TRUE;
                } else {
-                       gchar *tmp = g_strdup_printf("%s\n", msg);
-                       log_error(LOG_PROTOCOL, tmp);
-                       g_free(tmp);
+                       log_error(LOG_PROTOCOL, "%s\n", msg);
                }
                g_free(msg);
        }
index 57fc682..12493d2 100644 (file)
@@ -411,7 +411,7 @@ static gboolean gtk_message_callback(gpointer data)
        BogoCbData *cbdata = (BogoCbData *)data;
 
        if (cbdata->message)
-               statusbar_print_all(cbdata->message);
+               statusbar_print_all("%s", cbdata->message);
        else if (cbdata->total == 0) {
                statusbar_pop_all();
        }
index 5b7e110..cd9457e 100644 (file)
@@ -201,7 +201,7 @@ static struct ClamAvPage clamav_page;
 
 static void gtk_message_callback(gchar *message)
 {
-       statusbar_print_all(message);
+       statusbar_print_all("%s", message);
 }
 
 gint clamav_gtk_init(void)
index 055b18a..cf70ec0 100644 (file)
@@ -70,7 +70,7 @@ gpgme_verify_result_t sgpgme_verify_signature(gpgme_ctx_t ctx, gpgme_data_t sig,
 
        if ((err = gpgme_op_verify(ctx, sig, plain, dummy)) != GPG_ERR_NO_ERROR) {
                debug_print("op_verify err %s\n", gpgme_strerror(err));
-               privacy_set_error(gpgme_strerror(err));
+               privacy_set_error("%s", gpgme_strerror(err));
                return GINT_TO_POINTER(-GPG_ERR_SYSTEM_ERROR);
                
        }
index 9e01cab..0bf39e1 100644 (file)
@@ -317,13 +317,11 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
                                           "sure spamd is running and accessible.");
                if (!prefs_common.no_recv_err_panel) {
                        if (!warned_error) {
-                               alertpanel_error(msg);
+                               alertpanel_error("%s", msg);
                        }
                        warned_error = TRUE;
                } else {
-                       gchar *tmp = g_strdup_printf("%s\n", msg);
-                       log_error(LOG_PROTOCOL, tmp);
-                       g_free(tmp);
+                       log_error(LOG_PROTOCOL, "%s\n", msg);
                }
        }
        
index 59992a8..7eb6716 100644 (file)
@@ -551,7 +551,7 @@ static void spamassassin_save_func(PrefsPage *_page)
 
 static void gtk_message_callback(gchar *message)
 {
-       statusbar_print_all(message);
+       statusbar_print_all("%s", message);
 }
 
 static struct SpamAssassinPage spamassassin_page;
index f7bc3d5..506c64b 100644 (file)
@@ -1399,7 +1399,6 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
                    return NULL;
                }
                if (*expr == '\0') {
-                       gchar *msg;
                        gchar *tmp;
 
                        if (strcasecmp(header, Q_("Filtering Matcher Menu|All")) == 0)
@@ -1409,12 +1408,10 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
                                tmp = g_strdup(_("any address in any header"));
                        else
                                tmp = g_strdup_printf(_("the address(es) in header '%s'"), header);
-                       msg = g_strdup_printf(_("Book/folder path is not set.\n\n"
+                       alertpanel_error(_("Book/folder path is not set.\n\n"
                                                "If you want to match %s against the whole address book, "
                                                "you have to select 'Any' from the book/folder drop-down list."),
                                                tmp);
-                   alertpanel_error(msg);
-                       g_free(msg);
                        g_free(tmp);
                    return NULL;
                }
index 7bc3298..21812e4 100644 (file)
@@ -602,11 +602,7 @@ static gboolean prefs_template_list_view_set_row(GtkTreeIter *row)
                value = NULL;
                }
        if (!prefs_template_string_is_valid(value, &line)) {
-               gchar *msg;
-
-               msg = g_strdup_printf(_("Template body format error at line %d."), line);
-               alertpanel_error(msg);
-               g_free(msg);
+               alertpanel_error(_("Template body format error at line %d."), line);
                g_free(value);
                return FALSE;
        }
index f5fa9ed..70edd55 100644 (file)
@@ -418,9 +418,7 @@ void quotefmt_check_new_msg_formats(gboolean use_format,
                        alertpanel_error(_("New message subject format error."));
 
                if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       gchar *msg = g_strdup_printf(_("New message body format error at line %d."), line);
-                       alertpanel_error(msg);
-                       g_free(msg);
+                       alertpanel_error(_("New message body format error at line %d."), line);
                }
        }
 }
@@ -436,9 +434,7 @@ void quotefmt_check_reply_formats(gboolean use_format,
                        alertpanel_error(_("Message reply quotation mark format error."));
 
                if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       gchar *msg = g_strdup_printf(_("Message reply format error at line %d."), line);
-                       alertpanel_error(msg);
-                       g_free(msg);
+                       alertpanel_error(_("Message reply format error at line %d."), line);
                }
        }
 }
@@ -454,9 +450,7 @@ void quotefmt_check_forward_formats(gboolean use_format,
                        alertpanel_error(_("Message forward quotation mark format error."));
 
                if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       gchar *msg = g_strdup_printf(_("Message forward format error at line %d."), line);
-                       alertpanel_error(msg);
-                       g_free(msg);
+                       alertpanel_error(_("Message forward format error at line %d."), line);
                }
        }
 }
index 683fc6a..5c94fb1 100644 (file)
@@ -325,7 +325,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                    && (ac_prefs->protocol == A_APOP || ac_prefs->protocol == A_POP3)
                    && (time(NULL) - ac_prefs->last_pop_login_time) > (60 * ac_prefs->pop_before_smtp_timeout)) {
                        g_snprintf(buf, sizeof(buf), _("Doing POP before SMTP..."));
-                       log_message(LOG_PROTOCOL, buf);
+                       log_message(LOG_PROTOCOL, "%s\n", buf);
                        progress_dialog_set_label(dialog->dialog, buf);
                        progress_dialog_list_set_status(dialog->dialog, 0, _("POP before SMTP"));
                        GTK_EVENTS_FLUSH();
index 10bcf39..a80c894 100644 (file)
@@ -2421,11 +2421,9 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
                        alertpanel_error_log(_("Some errors occurred while "
                                           "sending queued messages."));
                else {
-                       gchar *tmp = g_strdup_printf(_("Some errors occurred "
+                       alertpanel_error_log(_("Some errors occurred "
                                        "while sending queued messages:\n%s"), errstr);
                        g_free(errstr);
-                       alertpanel_error_log(tmp);
-                       g_free(tmp);
                }
        }
 }