summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorjvoisin2018-02-07 11:57:16 +0100
committerjvoisin2018-02-07 11:57:16 +0100
commit9c2c9d805d92c846f472f994efb50e1ad2fb60b6 (patch)
tree1b38600bac2931752d2a018ab2973baa9342b384 /src/sp_disabled_functions.c
parent81bd738128f94e3da0f308a0d701a824de9f3af2 (diff)
Use assertions for things that should never happen
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c7
1 files changed, 4 insertions, 3 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
113static bool is_param_matching(zend_execute_data* execute_data, 112static 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;