[Xfce4-commits] <thunar:xfce-4.8> Fix segfault when plugin returns a NULL suffix.

Nick Schermer noreply at xfce.org
Wed Nov 30 21:28:01 CET 2011


Updating branch refs/heads/xfce-4.8
         to fb7e7a602473fe2f11c78baacacaad1aea8c9dc6 (commit)
       from c46f8a0441fa3586eba83c753d487537af4f0b4d (commit)

commit fb7e7a602473fe2f11c78baacacaad1aea8c9dc6
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Nov 30 18:45:57 2011 +0100

    Fix segfault when plugin returns a NULL suffix.
    
    (cherry picked from commit 6f813ba48553e5b95a83bfa8463b20b8ee4607c4)

 thunar/thunar-renamer-model.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-renamer-model.c b/thunar/thunar-renamer-model.c
index 1aa7b77..91a47e1 100644
--- a/thunar/thunar-renamer-model.c
+++ b/thunar/thunar-renamer-model.c
@@ -823,10 +823,9 @@ thunar_renamer_model_process_item (ThunarRenamerModel     *renamer_model,
           /* determine the new suffix */
           suffix = thunarx_renamer_process (renamer_model->renamer, THUNARX_FILE_INFO (item->file), dot + 1, idx);
 
-          /* generate the new file name */
-          name = g_new (gchar, (dot - display_name) + 1 + strlen (suffix) + 1);
-          memcpy (name, display_name, (dot - display_name) + 1);
-          memcpy (name + (dot - display_name) + 1, suffix, strlen (suffix) + 1);
+          prefix = g_strndup (display_name, (dot - display_name) + 1);
+          name = g_strconcat (prefix, suffix, NULL);
+          g_free (prefix);
 
           /* release the suffix */
           g_free (suffix);


More information about the Xfce4-commits mailing list