summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sp_execute.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c
index 65a32db..81614f3 100644
--- a/src/sp_execute.c
+++ b/src/sp_execute.c
@@ -87,8 +87,8 @@ inline static void is_builtin_matching(
87 should_disable_ht(EG(current_execute_data), function_name, param_value, param_name, SPCFG(disabled_functions_reg).disabled_functions, ht); 87 should_disable_ht(EG(current_execute_data), function_name, param_value, param_name, SPCFG(disabled_functions_reg).disabled_functions, ht);
88} 88}
89 89
90static void ZEND_HOT is_in_eval_and_whitelisted(const zend_execute_data *execute_data) { 90static void ZEND_HOT is_in_eval_and_whitelisted(zend_execute_data const* const execute_data) {
91 const sp_config_eval *config_eval = &(SPCFG(eval)); 91 sp_config_eval const* const config_eval = &(SPCFG(eval));
92 92
93 if (EXPECTED(0 == SPG(in_eval))) { 93 if (EXPECTED(0 == SPG(in_eval))) {
94 return; 94 return;
@@ -107,18 +107,18 @@ static void ZEND_HOT is_in_eval_and_whitelisted(const zend_execute_data *execute
107 return; 107 return;
108 } 108 }
109 109
110 if (UNEXPECTED(false == check_is_in_eval_whitelist(function_name))) { 110 if (UNEXPECTED(false == check_is_in_eval_whitelist(function_name))) {
111 if (config_eval->dump) { 111 if (config_eval->dump) {
112 sp_log_request(config_eval->dump, config_eval->textual_representation); 112 sp_log_request(config_eval->dump, config_eval->textual_representation);
113 }
114 if (config_eval->simulation) {
115 sp_log_simulation("Eval_whitelist", "The function '%s' isn't in the eval whitelist, logging its call.", function_name);
116 goto out;
117 } else {
118 sp_log_drop("Eval_whitelist", "The function '%s' isn't in the eval whitelist, dropping its call.", function_name);
119 }
120 } 113 }
121 // } 114 if (config_eval->simulation) {
115 sp_log_simulation("Eval_whitelist", "The function '%s' isn't in the eval whitelist, logging its call.", function_name);
116 goto out;
117 } else {
118 sp_log_drop("Eval_whitelist", "The function '%s' isn't in the eval whitelist, dropping its call.", function_name);
119 }
120 }
121
122out: 122out:
123 efree(function_name); 123 efree(function_name);
124} 124}
@@ -179,7 +179,7 @@ static inline void sp_execute_handler(INTERNAL_FUNCTION_PARAMETERS, bool interna
179 179
180 if (!internal) { 180 if (!internal) {
181 if (UNEXPECTED(EX(func)->op_array.type == ZEND_EVAL_CODE)) { 181 if (UNEXPECTED(EX(func)->op_array.type == ZEND_EVAL_CODE)) {
182 const sp_list_node *config = zend_hash_str_find_ptr(SPCFG(disabled_functions), ZEND_STRL("eval")); 182 sp_list_node const* const config = zend_hash_str_find_ptr(SPCFG(disabled_functions), ZEND_STRL("eval"));
183 183
184#if PHP_VERSION_ID >= 80000 184#if PHP_VERSION_ID >= 80000
185 is_builtin_matching(SPG(eval_source_string), "eval", "code", config, SPCFG(disabled_functions)); 185 is_builtin_matching(SPG(eval_source_string), "eval", "code", config, SPCFG(disabled_functions));
@@ -251,10 +251,8 @@ static inline void sp_execute_handler(INTERNAL_FUNCTION_PARAMETERS, bool interna
251 if (EX(return_value) == &ret_val) { 251 if (EX(return_value) == &ret_val) {
252 return_value = EX(return_value) = NULL; 252 return_value = EX(return_value) = NULL;
253 } 253 }
254
255} 254}
256 255
257
258static void sp_execute_ex(zend_execute_data *execute_data) { 256static void sp_execute_ex(zend_execute_data *execute_data) {
259 sp_execute_handler(execute_data, execute_data ? EX(return_value) : NULL, false); 257 sp_execute_handler(execute_data, execute_data ? EX(return_value) : NULL, false);
260} 258}
@@ -271,7 +269,7 @@ static inline void sp_stream_open_checks(zend_string *zend_filename, zend_file_h
271 return; 269 return;
272 } 270 }
273 271
274 const HashTable *disabled_functions_hooked = SPCFG(disabled_functions_hooked); 272 HashTable const* const disabled_functions_hooked = SPCFG(disabled_functions_hooked);
275 273
276 switch (data->opline->opcode) { 274 switch (data->opline->opcode) {
277 case ZEND_INCLUDE_OR_EVAL: 275 case ZEND_INCLUDE_OR_EVAL:
@@ -312,10 +310,6 @@ static inline void sp_stream_open_checks(zend_string *zend_filename, zend_file_h
312 EMPTY_SWITCH_DEFAULT_CASE(); // LCOV_EXCL_LINE 310 EMPTY_SWITCH_DEFAULT_CASE(); // LCOV_EXCL_LINE
313 } 311 }
314 } 312 }
315 // efree(zend_filename);
316
317// end:
318 // return orig_zend_stream_open(filename, handle);
319} 313}
320 314
321#if PHP_VERSION_ID < 80100 315#if PHP_VERSION_ID < 80100