From: hickert Date: Fri, 20 Oct 2006 09:05:42 +0000 (+0000) Subject: Fixed sieve script creation freeze, till memory exhausted. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d17fb8137c875d927e1e31ae6648dab98d0903f0;p=gosa.git Fixed sieve script creation freeze, till memory exhausted. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4907 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_sieve.inc b/include/class_sieve.inc index bdbf7d6fd..16b50f687 100644 --- a/include/class_sieve.inc +++ b/include/class_sieve.inc @@ -119,8 +119,13 @@ class sieve $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2); //we want to be nice and strip crlf's $this->err_recv = strlen($this->line); - while($this->err_recv < $this->err_len){ + /* Avoid loop till memory is full + This can happen if sieve script is modified via external scripts and not by gosa .. */ + $max = 10000; + $cur = 0 ; + while($this->err_recv < $this->err_len && ($cur < $max)){ //print "
Trying to receive ".($this->err_len-$this->err_recv)." bytes for result
"; + $cur ++ ; $this->line = fgets($this->fp, ($this->err_len-$this->err_recv)); $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2); //we want to be nice and strip crlf's $this->err_recv += strlen($this->line);