[telepathy-mission-control-5.14] telepathy-mission-control: Flag printf-ish functions with G_GNUC_PRINTF and fix resulting warnings
Simon McVittie
smcv at kemper.freedesktop.org
Mon Nov 18 05:18:51 PST 2013
Module: telepathy-mission-control
Branch: telepathy-mission-control-5.14
Commit: 455929e7d6214250399ad5157ca33bd4e4ee38a0
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=455929e7d6214250399ad5157ca33bd4e4ee38a0
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed Sep 18 13:07:57 2013 +0000
Flag printf-ish functions with G_GNUC_PRINTF and fix resulting warnings
In particular, mcd-account-manager-default could crash when migrating
an account, since it would dereference arbitrary stack contents
as a pointer-to-string.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69542
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
[backported to 5.14 for Ubuntu]
Tested-by: Sebastien Bacher <seb128 at ubuntu.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71539
---
src/mcd-account-manager-default.c | 3 ++-
src/mcd-account.c | 2 +-
src/mcd-debug.h | 2 +-
src/mcd-dispatcher.c | 2 +-
tests/account-store.c | 4 ++--
5 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index ef39ba1..a977692 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -777,7 +777,8 @@ _list (const McpAccountStorage *self,
if (_commit (self, am, NULL))
{
- DEBUG ("Migrated %s to new location: deleting old copy");
+ DEBUG ("Migrated %s to new location: deleting old copy",
+ old_filename);
if (g_unlink (old_filename) != 0)
g_warning ("Unable to delete %s: %s", old_filename,
g_strerror (errno));
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 256575b..6c7b414 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2422,7 +2422,7 @@ apply_parameter_updates (McdAccount *account,
g_hash_table_iter_init (&iter, dbus_properties);
while (g_hash_table_iter_next (&iter, &name, &value))
{
- DEBUG ("updating parameter %s", name);
+ DEBUG ("updating parameter %s", (const gchar *) name);
_mcd_connection_update_property (priv->connection, name, value);
}
}
diff --git a/src/mcd-debug.h b/src/mcd-debug.h
index 66fdafc..53da2d0 100644
--- a/src/mcd-debug.h
+++ b/src/mcd-debug.h
@@ -59,7 +59,7 @@ static inline gint _mcd_debug_get_level (void)
void mcd_debug_print_tree (gpointer obj);
-void mcd_debug (const gchar *format, ...);
+void mcd_debug (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
G_END_DECLS
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 48ebc83..45f0602 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -2034,7 +2034,7 @@ try_delegating (ChannelToDelegate *to_delegate)
g_strdup (mcd_channel_get_object_path (to_delegate->channel)),
v);
- DEBUG ("...but failed to delegate it: %s",
+ DEBUG ("...but failed to delegate %s: %s",
mcd_channel_get_object_path (to_delegate->channel),
to_delegate->error->message);
diff --git a/tests/account-store.c b/tests/account-store.c
index 7e609a1..cb2900b 100644
--- a/tests/account-store.c
+++ b/tests/account-store.c
@@ -87,7 +87,7 @@ const Backend backends[] = {
};
static void usage (const gchar *name, const gchar *fmt,
- ...) G_GNUC_NORETURN;
+ ...) G_GNUC_NORETURN G_GNUC_PRINTF (2, 3);
#if ENABLE_GNOME_KEYRING
#include <gnome-keyring.h>
@@ -141,7 +141,7 @@ int main (int argc, char **argv)
#endif
if (argc < 3)
- usage (argv[0], "");
+ usage (argv[0], "Not enough arguments");
op_name = argv[1];
backend = argv[2];
More information about the telepathy-commits
mailing list