From 9d284d6d8d489d231d20c8eef0035bdf01a2cbfe Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 11 Oct 2017 22:28:05 +0200 Subject: Hopefully fix an unreproductible NULL-deref in regexp matching Reported by @fr33tux --- src/sp_disabled_functions.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 7c079fb..c073b79 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c @@ -106,12 +106,10 @@ bool should_disable(zend_execute_data* execute_data) { const char* current_filename = zend_get_executed_filename(TSRMLS_C); const sp_node_t* config = SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions; - const char* function_name = - ZSTR_VAL(execute_data->func->common.function_name); - char* complete_path_function; + char* complete_path_function = get_complete_function_path(execute_data);; char const* client_ip = sp_getenv("REMOTE_ADDR"); - if (!function_name) { + if (!complete_path_function) { return false; } @@ -119,7 +117,6 @@ bool should_disable(zend_execute_data* execute_data) { return false; } - complete_path_function = get_complete_function_path(execute_data); while (config) { sp_disabled_function const* const config_node = @@ -278,6 +275,10 @@ static bool should_drop_on_ret(zval* return_value, const char* current_filename = zend_get_executed_filename(TSRMLS_C); char current_file_hash[SHA256_SIZE * 2] = {0}; + if (!complete_path_function) { + return false; + } + if (!config || !config->data) { return false; } -- cgit v1.3