From d309d278bf298d0fe7241b0c5cf2548e322b80a0 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 10 May 2016 13:13:50 +0100 Subject: [PATCH] Fix renaming files in a password-protected archive When opening a password-protected archive, and renaming a file within, the password dialog takes user input, sets the password for the archive and then restarts the rename action. As part of doing so, it frees the existing action and replaces it with a duplicate. However, pointers to fields inside the original (now freed) action struct are used to provide the old and new filenames, among other arguments. This leads to the file being deleted (although accessing freed memory is undefined, so other outcomes are possible). Fix the rename operation by always using the fields from the new struct, which exists for the lifetime of the rename action. https://bugzilla.redhat.com/show_bug.cgi?id=1233853 https://bugzilla.gnome.org/show_bug.cgi?id=766227 --- src/fr-window.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fr-window.c b/src/fr-window.c index fd161b7..1d0a661 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -8205,12 +8205,12 @@ rename_selection (FrWindow *window, fr_window_clipboard_remove_file_list (window, file_list); fr_archive_rename (window->archive, file_list, - old_name, - new_name, - current_dir, - is_dir, - dir_in_archive, - original_path, + rdata->old_name, + rdata->new_name, + rdata->current_dir, + rdata->is_dir, + rdata->dir_in_archive, + rdata->original_path, window->priv->cancellable, archive_rename_ready_cb, window); -- 2.8.2