Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/efreet

Dir     : e17/libs/efreet/src/lib


Modified Files:
        efreet_icon.c 


Log Message:


limit recursion - safety for bad theme config.

===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_icon.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- efreet_icon.c       15 Apr 2007 04:51:37 -0000      1.15
+++ efreet_icon.c       26 May 2007 06:45:51 -0000      1.16
@@ -340,6 +340,7 @@
                                                 const char *size)
 {
     Efreet_Icon *value;
+   static int recurse = 0;
 
     efreet_icon_theme_cache_check(theme);
 
@@ -350,6 +351,10 @@
     /* go no further if this theme is fake */
     if (theme->fake || !theme->valid) return NULL;
 
+    /* limit recursion in finding themes and inherited themes to 256 levels */
+    if (recurse > 256) return NULL;
+    recurse++;
+   
     value = efreet_icon_lookup_icon(theme, icon, size);    
 
     /* we didin't find the image check the inherited themes */
@@ -365,7 +370,7 @@
                 Efreet_Icon_Theme *parent_theme;
 
                 parent_theme = efreet_icon_theme_find(parent);
-                if (!parent_theme) continue;
+                if ((!parent_theme) || (parent_theme == theme)) continue;
 
                 value = efreet_icon_find_helper(parent_theme, cache_key, 
                                                             icon, size);
@@ -385,6 +390,7 @@
         }
     }
 
+    recurse--;
     return value;
 }
 



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to