diff options
| author | Ben Fuhrmannek | 2021-02-16 11:16:59 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2021-02-16 11:16:59 +0100 |
| commit | 5484bcb5eb2714e7438927e2566c86a74d7c51af (patch) | |
| tree | b78326d2999397be4c08e06b23209981f82a4ea9 /src/sp_execute.c | |
| parent | 7ac1e3866ef4f146c6c93a5ca13b9aebb14e936a (diff) | |
| parent | cecfdd808da67be908dbe7144cc8c74dfb3f855e (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/sp_execute.c')
| -rw-r--r-- | src/sp_execute.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c index 4eae874..de83a2a 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c | |||
| @@ -18,12 +18,12 @@ ZEND_COLD static inline void terminate_if_writable(const char *filename) { | |||
| 18 | SP_TOKEN_READONLY_EXEC); | 18 | SP_TOKEN_READONLY_EXEC); |
| 19 | } | 19 | } |
| 20 | if (true == config_ro_exec->simulation) { | 20 | if (true == config_ro_exec->simulation) { |
| 21 | sp_log_msg("readonly_exec", SP_LOG_SIMULATION, | 21 | sp_log_simulation("readonly_exec", |
| 22 | "Attempted execution of a writable file (%s).", filename); | 22 | "Attempted execution of a writable file (%s).", |
| 23 | filename); | ||
| 23 | } else { | 24 | } else { |
| 24 | sp_log_msg("readonly_exec", SP_LOG_DROP, | 25 | sp_log_drop("readonly_exec", |
| 25 | "Attempted execution of a writable file (%s).", filename); | 26 | "Attempted execution of a writable file (%s).", filename); |
| 26 | zend_bailout(); | ||
| 27 | } | 27 | } |
| 28 | } else { | 28 | } else { |
| 29 | if (EACCES != errno) { | 29 | if (EACCES != errno) { |
| @@ -79,14 +79,14 @@ is_in_eval_and_whitelisted(const zend_execute_data *execute_data) { | |||
| 79 | SP_TOKEN_EVAL_WHITELIST); | 79 | SP_TOKEN_EVAL_WHITELIST); |
| 80 | } | 80 | } |
| 81 | if (config_eval->simulation) { | 81 | if (config_eval->simulation) { |
| 82 | sp_log_msg( | 82 | sp_log_simulation( |
| 83 | "Eval_whitelist", SP_LOG_SIMULATION, | 83 | "Eval_whitelist", |
| 84 | "The function '%s' isn't in the eval whitelist, logging its call.", | 84 | "The function '%s' isn't in the eval whitelist, logging its call.", |
| 85 | ZSTR_VAL(current_function)); | 85 | ZSTR_VAL(current_function)); |
| 86 | return; | 86 | return; |
| 87 | } else { | 87 | } else { |
| 88 | sp_log_msg( | 88 | sp_log_drop( |
| 89 | "Eval_whitelist", SP_LOG_DROP, | 89 | "Eval_whitelist", |
| 90 | "The function '%s' isn't in the eval whitelist, dropping its call.", | 90 | "The function '%s' isn't in the eval whitelist, dropping its call.", |
| 91 | ZSTR_VAL(current_function)); | 91 | ZSTR_VAL(current_function)); |
| 92 | } | 92 | } |
| @@ -156,6 +156,7 @@ static void sp_execute_ex(zend_execute_data *execute_data) { | |||
| 156 | return; | 156 | return; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | // If we're at an internal function | ||
| 159 | if (!execute_data->prev_execute_data || | 160 | if (!execute_data->prev_execute_data || |
| 160 | !execute_data->prev_execute_data->func || | 161 | !execute_data->prev_execute_data->func || |
| 161 | !ZEND_USER_CODE(execute_data->prev_execute_data->func->type) || | 162 | !ZEND_USER_CODE(execute_data->prev_execute_data->func->type) || |
| @@ -163,17 +164,18 @@ static void sp_execute_ex(zend_execute_data *execute_data) { | |||
| 163 | should_disable_ht(execute_data, function_name, NULL, NULL, | 164 | should_disable_ht(execute_data, function_name, NULL, NULL, |
| 164 | config_disabled_functions_reg, | 165 | config_disabled_functions_reg, |
| 165 | config_disabled_functions); | 166 | config_disabled_functions); |
| 166 | } else if ((execute_data->prev_execute_data->opline->opcode == | 167 | } else { // If we're at a userland function call |
| 167 | ZEND_DO_FCALL || | 168 | switch (execute_data->prev_execute_data->opline->opcode) { |
| 168 | execute_data->prev_execute_data->opline->opcode == | 169 | case ZEND_DO_FCALL: |
| 169 | ZEND_DO_UCALL || | 170 | case ZEND_DO_FCALL_BY_NAME: |
| 170 | execute_data->prev_execute_data->opline->opcode == | 171 | case ZEND_DO_ICALL: |
| 171 | ZEND_DO_ICALL || | 172 | case ZEND_DO_UCALL: |
| 172 | execute_data->prev_execute_data->opline->opcode == | 173 | should_disable_ht(execute_data, function_name, NULL, NULL, |
| 173 | ZEND_DO_FCALL_BY_NAME)) { | 174 | config_disabled_functions_reg, |
| 174 | should_disable_ht(execute_data, function_name, NULL, NULL, | 175 | config_disabled_functions); |
| 175 | config_disabled_functions_reg, | 176 | default: |
| 176 | config_disabled_functions); | 177 | break; |
| 178 | } | ||
| 177 | } | 179 | } |
| 178 | 180 | ||
| 179 | // When a function's return value isn't used, php doesn't store it in the | 181 | // When a function's return value isn't used, php doesn't store it in the |
