[gtk+/gtk-2-24] win32: Don't crash when installed in a top-level directory



commit bbe8ba8affe619869c4b11a390341ec8c7b7c18b
Author: Kalev Lember <kalevlember gmail com>
Date:   Thu Feb 9 15:12:22 2012 +0200

    win32: Don't crash when installed in a top-level directory
    
    Avoid NULL-pointer dereference when package installation directory
    doesn't contain any slashes.
    
    Reported by PaweÅ Forysiuk.

 gtk/gtkmain.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a82ac51..5a88679 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -100,7 +100,8 @@ _gtk_get_libdir (void)
     {
       gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
       gchar *slash = strrchr (root, '\\');
-      if (g_ascii_strcasecmp (slash + 1, ".libs") == 0)
+      if (slash != NULL &&
+          g_ascii_strcasecmp (slash + 1, ".libs") == 0)
 	gtk_libdir = GTK_LIBDIR;
       else
 	gtk_libdir = g_build_filename (root, "lib", NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]