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

Nick Schermer noreply at xfce.org
Wed Nov 30 18:48:01 CET 2011


Updating branch refs/heads/master
         to 6f813ba48553e5b95a83bfa8463b20b8ee4607c4 (commit)
       from 51739512c675725c032cf94ac992c6432549fcf2 (commit)

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

    Fix segfault when plugin returns a NULL suffix.

 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