[Pkg-xfce-commits] r564 - desktop/trunk/thunar/debian/patches

Yves-Alexis Perez corsac-guest at costa.debian.org
Sun Apr 30 09:24:15 UTC 2006


Author: corsac-guest
Date: 2006-04-30 09:24:14 +0000 (Sun, 30 Apr 2006)
New Revision: 564

Added:
   desktop/trunk/thunar/debian/patches/02_fix-crash-with-desktop-files.patch
Log:
thunar segfaults on some .desktop files, this patch fixes that


Added: desktop/trunk/thunar/debian/patches/02_fix-crash-with-desktop-files.patch
===================================================================
--- desktop/trunk/thunar/debian/patches/02_fix-crash-with-desktop-files.patch	2006-04-28 13:16:31 UTC (rev 563)
+++ desktop/trunk/thunar/debian/patches/02_fix-crash-with-desktop-files.patch	2006-04-30 09:24:14 UTC (rev 564)
@@ -0,0 +1,52 @@
+Index: thunar-vfs/thunar-vfs-info.c
+===================================================================
+--- thunar-vfs/thunar-vfs-info.c	(revision 21117)
++++ thunar-vfs/thunar-vfs-info.c	(working copy)
+@@ -944,12 +944,21 @@
+                 }
+ 
+               /* check if we have a valid name info */
+-              str = xfce_rc_read_entry (rc, "Name", NULL);
+-              if (G_LIKELY (str != NULL && *str != '\0' && g_utf8_validate (str, -1, NULL)))
++              name = xfce_rc_read_entry (rc, "Name", NULL);
++              if (G_LIKELY (name != NULL && *name != '\0' && g_utf8_validate (name, -1, NULL)))
+                 {
+                   /* check if we declared the file as executable */
+                   if ((info->flags & THUNAR_VFS_FILE_FLAGS_EXECUTABLE) != 0)
+                     {
++                      /* if the name contains a dir separator, use only the part after
++                       * the dir separator for checking.
++                       */
++                      str = strrchr (name, G_DIR_SEPARATOR);
++                      if (G_LIKELY (str == NULL))
++                        str = (gchar *) name;
++                      else
++                        str += 1;
++
+                       /* check if the file tries to look like a regular document (i.e.
+                        * a display name of 'file.png'), maybe a virus or other malware.
+                        */
+@@ -972,20 +981,20 @@
+                           info->custom_icon = NULL;
+ 
+                           /* reset the name str, so we display the real file name */
+-                          str = NULL;
++                          name = NULL;
+                         }
+                       thunar_vfs_mime_info_unref (fake_mime_info);
+                     }
+ 
+                   /* check if the name str wasn't reset */
+-                  if (G_LIKELY (str != NULL))
++                  if (G_LIKELY (name != NULL))
+                     {
+                       /* release the previous display name */
+                       if (G_UNLIKELY (info->display_name != thunar_vfs_path_get_name (info->path)))
+                         g_free (info->display_name);
+ 
+                       /* use the name specified by the .desktop file as display name */
+-                      info->display_name = g_strdup (str);
++                      info->display_name = g_strdup (name);
+                     }
+                 }
+ 




More information about the Pkg-xfce-commits mailing list