From 70310b8f359e1276e3fa6ed326a8f91d9b02f0fc Mon Sep 17 00:00:00 2001 From: Stefan Esser Date: Wed, 11 Jan 2012 19:57:40 +0100 Subject: Fix git repository. Github had the wrong git repository commited. The last revisions were missing. From here we can continue developing. --- memory_limit.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'memory_limit.c') diff --git a/memory_limit.c b/memory_limit.c index 84c0bf3..c135ab4 100644 --- a/memory_limit.c +++ b/memory_limit.c @@ -47,12 +47,20 @@ static PHP_INI_MH(suhosin_OnChangeMemoryLimit) SUHOSIN_G(hard_memory_limit) = 0; } if (new_value) { - PG(memory_limit) = zend_atoi(new_value, new_value_length); - if (PG(memory_limit) > hard_memory_limit || PG(memory_limit) < 0) { - suhosin_log(S_MISC, "script tried to increase memory_limit to %u bytes which is above the allowed value", PG(memory_limit)); - if (!SUHOSIN_G(simulation)) { - PG(memory_limit) = hard_memory_limit; - return FAILURE; + PG(memory_limit) = zend_atol(new_value, new_value_length); + if (hard_memory_limit > 0) { + if (PG(memory_limit) > hard_memory_limit) { + suhosin_log(S_MISC, "script tried to increase memory_limit to %u bytes which is above the allowed value", PG(memory_limit)); + if (!SUHOSIN_G(simulation)) { + PG(memory_limit) = hard_memory_limit; + return FAILURE; + } + } else if (PG(memory_limit) < 0) { + suhosin_log(S_MISC, "script tried to disable memory_limit by setting it to a negative value %d bytes which is not allowed", PG(memory_limit)); + if (!SUHOSIN_G(simulation)) { + PG(memory_limit) = hard_memory_limit; + return FAILURE; + } } } } else { -- cgit v1.3