Mustn't we also pop the stack for this to work?

S.

On 12/04/2013 12:25 PM, Carsten Haitzler wrote:
> raster pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=f6f28bf75a65db419ba2dd46f70245afe9d26ba2
>
> commit f6f28bf75a65db419ba2dd46f70245afe9d26ba2
> Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
> Date:   Wed Dec 4 20:22:26 2013 +0900
>
>      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.
> ---
>   src/bin/efreet/efreetd_cache.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/bin/efreet/efreetd_cache.c b/src/bin/efreet/efreetd_cache.c
> index 94e48f1..5b45487 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
>
>      if (stat(path, &st) == -1) return;
>      if (eina_inarray_search(stack, &st, stat_cmp) >= 0) 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))
> @@ -302,6 +304,8 @@ desktop_changes_listen_recursive(Eina_Inarray *stack, 
> const char *path, Eina_Boo
>
>      if (stat(path, &st) == -1) return;
>      if (eina_inarray_search(stack, &st, stat_cmp) >= 0) 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))
>        {
>


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to