aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2008-01-07 00:43:58 +0800
committerSuman Manjunath <msuman@src.gnome.org>2008-01-07 00:43:58 +0800
commit82f7125f45269be8d2cded86d8c7fe37bd0364dc (patch)
treefbaae0c1b3a295879d0e7d21205dbe00c3d3d0cb /plugins
parent07cd05990fb01fc9021c23f0a29b3d49f6271ecd (diff)
downloadgsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar.gz
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar.bz2
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar.lz
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar.xz
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.tar.zst
gsoc2013-evolution-82f7125f45269be8d2cded86d8c7fe37bd0364dc.zip
Patch from Christian Krause <chkr@plauener.de>: Fix for bug #506772 (Not-NULL check for a string array before finding its length), handle NULL filename strings before backup/restore/check operations in the backup-restore plugin.
svn path=/trunk/; revision=34768
Diffstat (limited to 'plugins')
-rw-r--r--plugins/backup-restore/ChangeLog6
-rw-r--r--plugins/backup-restore/backup.c47
-rw-r--r--plugins/google-account-setup/ChangeLog2
3 files changed, 33 insertions, 22 deletions
diff --git a/plugins/backup-restore/ChangeLog b/plugins/backup-restore/ChangeLog
index 94cbeb44e6..13f250e5b5 100644
--- a/plugins/backup-restore/ChangeLog
+++ b/plugins/backup-restore/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-06 Christian Krause <chkr@plauener.de>
+
+ * backup.c: (backup), (restore), (check), (main): Initialize static
+ variables before use, not-NULL checks for filename before
+ backup/restore/check operations.
+
2007-08-07 Johnny Jacob <jjohnny@novell.com>
* Committed on behalf of Anand V M <avmuttagi@gmail.com>
diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c
index ec3e0b16be..6c19871d4c 100644
--- a/plugins/backup-restore/backup.c
+++ b/plugins/backup-restore/backup.c
@@ -21,11 +21,11 @@
#define ARCHIVE_NAME "evolution-backup.tar.gz"
static gboolean backup_op = FALSE;
-static char *bk_file;
+static char *bk_file = NULL;
static gboolean restore_op = FALSE;
-static char *res_file;
+static char *res_file = NULL;
static gboolean check_op = FALSE;
-static char *chk_file;
+static char *chk_file = NULL;
static gboolean restart_arg = FALSE;
static gboolean gui_arg = FALSE;
static gchar **opt_remaining = NULL;
@@ -63,6 +63,8 @@ backup (const char *filename)
{
char *command;
+ g_return_if_fail (filename && *filename);
+
CANCEL (complete);
txt = _("Shutting down Evolution");
/* FIXME Will the versioned setting always work? */
@@ -72,7 +74,6 @@ backup (const char *filename)
txt = _("Backing Evolution accounts and settings");
s ("gconftool-2 --dump " GCONF_DIR " > " GCONF_DUMP_PATH);
-
CANCEL (complete);
txt = _("Backing Evolution data (Mails, Contacts, Calendar, Tasks, Memos)");
@@ -102,6 +103,8 @@ restore (const char *filename)
{
char *command;
+ g_return_if_fail (filename && *filename);
+
/* FIXME Will the versioned setting always work? */
CANCEL (complete);
txt = _("Shutting down Evolution");
@@ -142,6 +145,8 @@ check (const char *filename)
{
char *command;
+ g_return_if_fail (filename && *filename);
+
command = g_strdup_printf ("tar ztf %s | grep -e \"^\\.evolution/$\"", filename);
result = system (command);
g_free (command);
@@ -238,21 +243,22 @@ main (int argc, char **argv)
GNOME_PARAM_GOPTION_CONTEXT, context,
GNOME_PARAM_NONE);
-
- for (i = 0; i < g_strv_length (opt_remaining); i++) {
- if (backup_op) {
- oper = _("Backing up to the folder %s");
- d(g_message ("Backing up to the folder %s", (char *) opt_remaining[i]));
- bk_file = g_strdup ((char *) opt_remaining[i]);
- file = bk_file;
- } else if (restore_op) {
- oper = _("Restoring from the folder %s");
- d(g_message ("Restoring from the folder %s", (char *) opt_remaining[i]));
- res_file = g_strdup ((char *) opt_remaining[i]);
- file = res_file;
- } else if (check_op) {
- d(g_message ("Checking %s", (char *) opt_remaining[i]));
- chk_file = g_strdup ((char *) opt_remaining[i]);
+ if (opt_remaining) {
+ for (i = 0; i < g_strv_length (opt_remaining); i++) {
+ if (backup_op) {
+ oper = _("Backing up to the folder %s");
+ d(g_message ("Backing up to the folder %s", (char *) opt_remaining[i]));
+ bk_file = g_strdup ((char *) opt_remaining[i]);
+ file = bk_file;
+ } else if (restore_op) {
+ oper = _("Restoring from the folder %s");
+ d(g_message ("Restoring from the folder %s", (char *) opt_remaining[i]));
+ res_file = g_strdup ((char *) opt_remaining[i]);
+ file = res_file;
+ } else if (check_op) {
+ d(g_message ("Checking %s", (char *) opt_remaining[i]));
+ chk_file = g_strdup ((char *) opt_remaining[i]);
+ }
}
}
@@ -267,6 +273,7 @@ main (int argc, char **argv)
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
NULL);
+
if (oper && file)
str = g_strdup_printf(oper, file);
@@ -282,8 +289,6 @@ main (int argc, char **argv)
pbar = gtk_progress_bar_new ();
gtk_box_pack_start ((GtkBox *)hbox, pbar, TRUE, TRUE, 6);
-
-
gtk_box_pack_start ((GtkBox *)vbox, hbox, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(progress_dialog)->vbox), vbox);
diff --git a/plugins/google-account-setup/ChangeLog b/plugins/google-account-setup/ChangeLog
index 91381d897d..63dcef3a7f 100644
--- a/plugins/google-account-setup/ChangeLog
+++ b/plugins/google-account-setup/ChangeLog
@@ -1,4 +1,4 @@
-2007-12-23 Nyall <nyall@zombiepigs.net>
+2007-12-23 Nyall Dawson <nyall@zombiepigs.net>
** Fix for bug #503954