diff options
| -rw-r--r-- | src/sp_disabled_functions.c | 7 | ||||
| -rw-r--r-- | src/sp_var_parser.c | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 779240e..4d94a97 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c | |||
| @@ -107,7 +107,6 @@ static const sp_list_node* get_config_node(const char* builtin_name) { | |||
| 107 | .config_disabled_constructs->construct_include; | 107 | .config_disabled_constructs->construct_include; |
| 108 | } | 108 | } |
| 109 | ZEND_ASSUME(0); | 109 | ZEND_ASSUME(0); |
| 110 | return NULL; // This should never happen. | ||
| 111 | } | 110 | } |
| 112 | 111 | ||
| 113 | static bool is_param_matching(zend_execute_data* execute_data, | 112 | static bool is_param_matching(zend_execute_data* execute_data, |
| @@ -360,6 +359,8 @@ bool should_drop_on_ret(zval* return_value, | |||
| 360 | sp_disabled_function const* const config_node = | 359 | sp_disabled_function const* const config_node = |
| 361 | (sp_disabled_function*)(config->data); | 360 | (sp_disabled_function*)(config->data); |
| 362 | 361 | ||
| 362 | assert(config_node->function || config_node->r_function); | ||
| 363 | |||
| 363 | if (config_node->function) { | 364 | if (config_node->function) { |
| 364 | if (0 != strcmp(config_node->function, complete_path_function)) { | 365 | if (0 != strcmp(config_node->function, complete_path_function)) { |
| 365 | goto next; | 366 | goto next; |
| @@ -443,14 +444,14 @@ static int hook_functions(const sp_list_node* config) { | |||
| 443 | const sp_pcre* function_name_regexp = | 444 | const sp_pcre* function_name_regexp = |
| 444 | ((sp_disabled_function*)config->data)->r_function; | 445 | ((sp_disabled_function*)config->data)->r_function; |
| 445 | 446 | ||
| 447 | assert(function_name || function_name_regexp); | ||
| 448 | |||
| 446 | if (NULL != function_name) { // hook function by name | 449 | if (NULL != function_name) { // hook function by name |
| 447 | HOOK_FUNCTION(function_name, disabled_functions_hook, | 450 | HOOK_FUNCTION(function_name, disabled_functions_hook, |
| 448 | PHP_FN(check_disabled_function)); | 451 | PHP_FN(check_disabled_function)); |
| 449 | } else if (NULL != function_name_regexp) { // hook function by regexp | 452 | } else if (NULL != function_name_regexp) { // hook function by regexp |
| 450 | HOOK_FUNCTION_BY_REGEXP(function_name_regexp, disabled_functions_hook, | 453 | HOOK_FUNCTION_BY_REGEXP(function_name_regexp, disabled_functions_hook, |
| 451 | PHP_FN(check_disabled_function)); | 454 | PHP_FN(check_disabled_function)); |
| 452 | } else { | ||
| 453 | return FAILURE; | ||
| 454 | } | 455 | } |
| 455 | 456 | ||
| 456 | config = config->next; | 457 | config = config->next; |
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c index 8e5bdb1..b57386e 100644 --- a/src/sp_var_parser.c +++ b/src/sp_var_parser.c | |||
| @@ -24,9 +24,8 @@ static bool is_var_name_valid(const char *name) { | |||
| 24 | static sp_pcre *regexp_const = NULL; | 24 | static sp_pcre *regexp_const = NULL; |
| 25 | static sp_pcre *regexp_var = NULL; | 25 | static sp_pcre *regexp_var = NULL; |
| 26 | 26 | ||
| 27 | if (!name) { | 27 | assert(name); |
| 28 | return false; | 28 | |
| 29 | } | ||
| 30 | if (NULL == regexp_var || NULL == regexp_const) { | 29 | if (NULL == regexp_var || NULL == regexp_const) { |
| 31 | regexp_var = sp_pcre_compile(REGEXP_VAR); | 30 | regexp_var = sp_pcre_compile(REGEXP_VAR); |
| 32 | regexp_const = sp_pcre_compile(REGEXP_CONST); | 31 | regexp_const = sp_pcre_compile(REGEXP_CONST); |
| @@ -46,9 +45,8 @@ static int create_var(sp_tree *tree, const char *restrict value, | |||
| 46 | const char *restrict idx) { | 45 | const char *restrict idx) { |
| 47 | sp_tree *var_node = NULL; | 46 | sp_tree *var_node = NULL; |
| 48 | 47 | ||
| 49 | if (!tree) { | 48 | assert(tree); |
| 50 | return -1; | 49 | |
| 51 | } | ||
| 52 | if (tree->next == NULL && tree->type == UNDEFINED) { | 50 | if (tree->next == NULL && tree->type == UNDEFINED) { |
| 53 | var_node = tree; | 51 | var_node = tree; |
| 54 | } else { | 52 | } else { |
