From: Ilia Alshanetsky Date: Mon, 16 Dec 2002 15:44:06 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.3.0RC4~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33ccce804707e799c8c982b4826fbd9779d4c34f;p=php MFH --- diff --git a/main/main.c b/main/main.c index 0c18c8a909..1ff232f9a6 100644 --- a/main/main.c +++ b/main/main.c @@ -168,15 +168,36 @@ static PHP_INI_MH(OnChangeMemoryLimit) */ static void php_disable_functions(TSRMLS_D) { - char *func; - char *new_value_dup = strdup(INI_STR("disable_functions")); /* This is an intentional leak, - * it's not a big deal as it's process-wide - */ - - func = strtok(new_value_dup, ", "); - while (func) { - zend_disable_function(func, strlen(func) TSRMLS_CC); - func = strtok(NULL, ", "); + char *s = NULL; + char *e = INI_STR("disable_functions"); + char p; + + if (!*e) { + return; + } + + while (*e) { + switch (*e) { + case ' ': + case ',': + if (s) { + p = *e; + *e = '\0'; + zend_disable_function(s, e-s TSRMLS_CC); + *e = p; + s = NULL; + } + break; + default: + if (!s) { + s = e; + } + break; + } + e++; + } + if (s) { + zend_disable_function(s, e-s TSRMLS_CC); } } /* }}} */