Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Hopefully fix an unreproductible NULL-deref in regexp matching
Browse files Browse the repository at this point in the history
Reported by @fr33tux
  • Loading branch information
jvoisin committed Oct 11, 2017
1 parent 17f59cf commit 9d284d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/sp_disabled_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,17 @@ 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;
}

if (!config || !config->data) {
return false;
}

complete_path_function = get_complete_function_path(execute_data);

while (config) {
sp_disabled_function const* const config_node =
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9d284d6

Please sign in to comment.