diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-12-04 20:22:26 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-12-04 20:32:09 +0900 |
commit | d757addd64d0e29232b417a3cf9686335eed621c (patch) | |
tree | d81a57468b3f5397617cd6cb796d95c336cb4c4f | |
parent | 8e6df617bb976536ab82d0c802ba918e40cf0fd8 (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.
Conflicts:
src/bin/efreet/efreetd_cache.c
-rw-r--r-- | src/bin/efreet/efreetd_cache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bin/efreet/efreetd_cache.c b/src/bin/efreet/efreetd_cache.c index 6ca556ad2..107f697b7 100644 --- a/src/bin/efreet/efreetd_cache.c +++ b/src/bin/efreet/efreetd_cache.c @@ -271,6 +271,8 @@ icon_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Bool b if ((st2->st_dev == st.st_dev) && (st2->st_ino == st.st_ino)) return; } + // protect against too deep recursion even if it's valid. + if (eina_inarray_count(stack) >= 8) return; eina_inarray_push(stack, &st); if ((!ecore_file_is_dir(path)) && (base)) @@ -321,7 +323,10 @@ desktop_changes_listen_recursive(Eina_Inarray *stack, const char *path, Eina_Boo if ((st2->st_dev == st.st_dev) && (st2->st_ino == st.st_ino)) return; } + // protect against too deep recursion even if it's valid. + if (eina_inarray_count(stack) >= 3) return; eina_inarray_push(stack, &st); + if ((!ecore_file_is_dir(path)) && (base)) { // XXX: if it doesn't exist... walk the parent dirs back down |