summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2017-10-11 22:28:05 +0200
committerjvoisin2017-10-11 22:28:05 +0200
commit9d284d6d8d489d231d20c8eef0035bdf01a2cbfe (patch)
tree42f6bb16b2ba35bc86411a58cebd2eaa1658fb02
parent17f59cf9689e4a0d5d3c020eeb9a78c03f62e858 (diff)
Hopefully fix an unreproductible NULL-deref in regexp matching
Reported by @fr33tux
-rw-r--r--src/sp_disabled_functions.c11
1 files 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) {
106 const char* current_filename = zend_get_executed_filename(TSRMLS_C); 106 const char* current_filename = zend_get_executed_filename(TSRMLS_C);
107 const sp_node_t* config = 107 const sp_node_t* config =
108 SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions; 108 SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions;
109 const char* function_name = 109 char* complete_path_function = get_complete_function_path(execute_data);;
110 ZSTR_VAL(execute_data->func->common.function_name);
111 char* complete_path_function;
112 char const* client_ip = sp_getenv("REMOTE_ADDR"); 110 char const* client_ip = sp_getenv("REMOTE_ADDR");
113 111
114 if (!function_name) { 112 if (!complete_path_function) {
115 return false; 113 return false;
116 } 114 }
117 115
@@ -119,7 +117,6 @@ bool should_disable(zend_execute_data* execute_data) {
119 return false; 117 return false;
120 } 118 }
121 119
122 complete_path_function = get_complete_function_path(execute_data);
123 120
124 while (config) { 121 while (config) {
125 sp_disabled_function const* const config_node = 122 sp_disabled_function const* const config_node =
@@ -278,6 +275,10 @@ static bool should_drop_on_ret(zval* return_value,
278 const char* current_filename = zend_get_executed_filename(TSRMLS_C); 275 const char* current_filename = zend_get_executed_filename(TSRMLS_C);
279 char current_file_hash[SHA256_SIZE * 2] = {0}; 276 char current_file_hash[SHA256_SIZE * 2] = {0};
280 277
278 if (!complete_path_function) {
279 return false;
280 }
281
281 if (!config || !config->data) { 282 if (!config || !config->data) {
282 return false; 283 return false;
283 } 284 }