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
This commit is contained in:
Suman Manjunath
2008-01-06 16:43:58 +00:00
parent 07cd05990f
commit 82f7125f45
5 changed files with 41 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2008-01-06 Christian Krause <chkr@plauener.de>
** Fix for bug #506772
* tools/evolution-addressbook-export.c: (main): Not-NULL check for a
string array before finding its length.
2007-12-11 Sankar P <psankar@novell.com>
** Fix for bug #501969

View File

@ -92,7 +92,7 @@ main (int argc, char **argv)
GNOME_PARAM_NONE);
/* Parsing Parameter */
if (g_strv_length (opt_remaining) > 0)
if (opt_remaining && g_strv_length (opt_remaining) > 0)
opt_addressbook_folder_uri = g_strdup (opt_remaining[0]);
if (opt_list_folders_mode != FALSE) {

View File

@ -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>

View File

@ -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);

View File

@ -1,4 +1,4 @@
2007-12-23 Nyall <nyall@zombiepigs.net>
2007-12-23 Nyall Dawson <nyall@zombiepigs.net>
** Fix for bug #503954