[Xfce4-commits] <thunar:xfce-4.8> Fix segfault when calling strcasecmp with NULL parameters (bug #7206).

Jannis Pohlmann noreply at xfce.org
Sat Jan 29 18:30:03 CET 2011


Updating branch refs/heads/xfce-4.8
         to 9c67fe4bd38530cb169b50339bf5fb846e2a6f67 (commit)
       from 126b3fe860869fd45b532a8d1210ad9f23ed5b6e (commit)

commit 9c67fe4bd38530cb169b50339bf5fb846e2a6f67
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sat Jan 29 18:27:15 2011 +0100

    Fix segfault when calling strcasecmp with NULL parameters (bug #7206).

 NEWS                       |    1 +
 thunar/thunar-list-model.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index e258539..208c349 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@
 - Don't interpret file display names as format strings (bug #7128).
 - Ship stock_folder-copy.png and stock_folder-move.png icons with
   Thunar itself (bug #6851).
+- Fix segfault when calling strcasecmp with NULL parameters (bug #7206).
 
 1.2.0
 =====
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index dacb4ad..f5e42b3 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -1,7 +1,7 @@
 /* $Id$ */
 /*-
  * Copyright (c) 2004-2007 Benedikt Meurer <benny at xfce.org>
- * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis at xfce.org>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -1643,6 +1643,15 @@ sort_by_type (const ThunarFile *a,
       description_b = g_content_type_get_description (content_type_b);
     }
 
+  /* avoid calling strcasecmp with NULL parameters */
+  if (description_a == NULL || description_b == NULL)
+    {
+      g_free (description_a);
+      g_free (description_b);
+
+      return 0;
+    }
+
   if (!case_sensitive)
     result = strcasecmp (description_a, description_b);
   else



More information about the Xfce4-commits mailing list