commit f97a15958bb4647b8123be104dafc26dfce3d761
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Sun Jan 2 01:46:21 2011 +0000

    Fixes to stop crashes if syncronising directories is switched on
    
    * gtkpod_app_iface.c
     * If name is null, stop any lookups occurring in the hash table
    
    * file.c
     * If there is no dot in the path / filename then return a null type since
       it cannot be identified, rather than blindly adding 1 to the pointer and
       risking an array out of bounds sigsev

 libgtkpod/file.c             |    6 +++++-
 libgtkpod/gtkpod_app_iface.c |    3 +++
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgtkpod/file.c b/libgtkpod/file.c
index 00702cd..663ab58 100644
--- a/libgtkpod/file.c
+++ b/libgtkpod/file.c
@@ -76,7 +76,11 @@ FileType *determine_filetype(const gchar *path) {
         return type;
 
     path_utf8 = charset_to_utf8(path);
-    suf = strrchr(path_utf8, '.') + 1;
+    suf = g_strrstr(path_utf8, ".");
+    if (!suf)
+        return type;
+
+    suf = suf + 1;
     type = gtkpod_get_filetype(suf);
 
     g_free(path_utf8);
diff --git a/libgtkpod/gtkpod_app_iface.c b/libgtkpod/gtkpod_app_iface.c
index 542bb49..a3a9fe5 100644
--- a/libgtkpod/gtkpod_app_iface.c
+++ b/libgtkpod/gtkpod_app_iface.c
@@ -683,6 +683,9 @@ gboolean gtkpod_filetype_is_supported(gchar *name) {
 
 FileType* gtkpod_get_filetype(gchar *name) {
     g_return_val_if_fail(GTKPOD_IS_APP(gtkpod_app), FALSE);
+    if (! name)
+        return NULL;
+
     GtkPodAppInterface *gp_iface = GTKPOD_APP_GET_INTERFACE (gtkpod_app);
     return g_hash_table_lookup(gp_iface->filetypes, name);
 }

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to