summaryrefslogtreecommitdiff
path: root/src/bin/efreet
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-04 20:22:26 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-04 20:25:57 +0900
commitf6f28bf75a65db419ba2dd46f70245afe9d26ba2 (patch)
tree12b122e07b1a87c016b8576497e13afe2bb22e24 /src/bin/efreet
parenta1b57d353672af762af9433310b64833828cf978 (diff)
efreet - protect efreetd from recursing too far to save overhead and mem
an errant path made its way into my efreet cache. this had a side-effect of causing efreetd to scan my entire $HOME recursively to monitor everything. while the original cause was $HOME getting in, we shouldn't have efreetd sit and consume scan all of $HOME when this is far from a normal situation. the recursive scanning is there ot handle some minimal levels of subdirs in app directories, but not an entire filesystem, so this mitigates the effects of errant cache data by limiting the amount of recursion allows for icon dirs and desktop dirs to 8 and 3 levels respectively.
Diffstat (limited to 'src/bin/efreet')
-rw-r--r--src/bin/efreet/efreetd_cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/efreet/efreetd_cache.c b/src/bin/efreet/efreetd_cache.c
index 94e48f1dda..5b454875b3 100644
--- a/src/bin/efreet/efreetd_cache.c
+++ b/src/bin/efreet/efreetd_cache.c
@@ -268,6 +268,8 @@ icon_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Bool b
268 268
269 if (stat(path, &st) == -1) return; 269 if (stat(path, &st) == -1) return;
270 if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return; 270 if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return;
271 // protect against too deep recursion even if it's valid.
272 if (eina_inarray_count(stack) >= 8) return;
271 eina_inarray_push(stack, &st); 273 eina_inarray_push(stack, &st);
272 274
273 if ((!ecore_file_is_dir(path)) && (base)) 275 if ((!ecore_file_is_dir(path)) && (base))
@@ -302,6 +304,8 @@ desktop_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Boo
302 304
303 if (stat(path, &st) == -1) return; 305 if (stat(path, &st) == -1) return;
304 if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return; 306 if (eina_inarray_search(stack, &st, stat_cmp) >= 0) return;
307 // protect against too deep recursion even if it's valid.
308 if (eina_inarray_count(stack) >= 3) return;
305 eina_inarray_push(stack, &st); 309 eina_inarray_push(stack, &st);
306 if ((!ecore_file_is_dir(path)) && (base)) 310 if ((!ecore_file_is_dir(path)) && (base))
307 { 311 {