diff options
Diffstat (limited to 'memory_limit.c')
| -rw-r--r-- | memory_limit.c | 20 |
1 files changed, 14 insertions, 6 deletions
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) | |||
| 47 | SUHOSIN_G(hard_memory_limit) = 0; | 47 | SUHOSIN_G(hard_memory_limit) = 0; |
| 48 | } | 48 | } |
| 49 | if (new_value) { | 49 | if (new_value) { |
| 50 | PG(memory_limit) = zend_atoi(new_value, new_value_length); | 50 | PG(memory_limit) = zend_atol(new_value, new_value_length); |
| 51 | if (PG(memory_limit) > hard_memory_limit || PG(memory_limit) < 0) { | 51 | if (hard_memory_limit > 0) { |
| 52 | suhosin_log(S_MISC, "script tried to increase memory_limit to %u bytes which is above the allowed value", PG(memory_limit)); | 52 | if (PG(memory_limit) > hard_memory_limit) { |
| 53 | if (!SUHOSIN_G(simulation)) { | 53 | suhosin_log(S_MISC, "script tried to increase memory_limit to %u bytes which is above the allowed value", PG(memory_limit)); |
| 54 | PG(memory_limit) = hard_memory_limit; | 54 | if (!SUHOSIN_G(simulation)) { |
| 55 | return FAILURE; | 55 | PG(memory_limit) = hard_memory_limit; |
| 56 | return FAILURE; | ||
| 57 | } | ||
| 58 | } else if (PG(memory_limit) < 0) { | ||
| 59 | 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)); | ||
| 60 | if (!SUHOSIN_G(simulation)) { | ||
| 61 | PG(memory_limit) = hard_memory_limit; | ||
| 62 | return FAILURE; | ||
| 63 | } | ||
| 56 | } | 64 | } |
| 57 | } | 65 | } |
| 58 | } else { | 66 | } else { |
