summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index 79dc5a7..b5cbe14 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -7,7 +7,7 @@ ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
7 7
8char* get_complete_function_path(zend_execute_data const* const execute_data) { 8char* get_complete_function_path(zend_execute_data const* const execute_data) {
9 if (zend_is_executing() && !EG(current_execute_data)->func) { 9 if (zend_is_executing() && !EG(current_execute_data)->func) {
10 return NULL; 10 return NULL; // LCOV_EXCL_LINE
11 } 11 }
12 if (!(execute_data->func->common.function_name)) { 12 if (!(execute_data->func->common.function_name)) {
13 return NULL; 13 return NULL;
@@ -259,7 +259,7 @@ bool should_disable_ht(zend_execute_data* execute_data,
259 zend_string* current_filename; 259 zend_string* current_filename;
260 260
261 if (!execute_data) { 261 if (!execute_data) {
262 return false; 262 return false; // LCOV_EXCL_LINE
263 } 263 }
264 264
265 if (UNEXPECTED(builtin_param && !strcmp(function_name, "eval"))) { 265 if (UNEXPECTED(builtin_param && !strcmp(function_name, "eval"))) {
@@ -509,7 +509,6 @@ ZEND_FUNCTION(check_disabled_function) {
509 SNUFFLEUPAGUS_G(config) 509 SNUFFLEUPAGUS_G(config)
510 .config_disabled_functions_reg->disabled_functions, 510 .config_disabled_functions_reg->disabled_functions,
511 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked)) { 511 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked)) {
512 zend_bailout();
513 } 512 }
514 513
515 orig_handler = zend_hash_str_find_ptr( 514 orig_handler = zend_hash_str_find_ptr(
@@ -522,7 +521,6 @@ ZEND_FUNCTION(check_disabled_function) {
522 .config_disabled_functions_reg_ret->disabled_functions, 521 .config_disabled_functions_reg_ret->disabled_functions,
523 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, 522 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked,
524 execute_data)) { 523 execute_data)) {
525 zend_bailout();
526 } 524 }
527} 525}
528 526
@@ -593,7 +591,6 @@ ZEND_FUNCTION(eval_blacklist_callback) {
593 sp_log_msg("eval", SP_LOG_DROP, 591 sp_log_msg("eval", SP_LOG_DROP,
594 "A call to %s was tried in eval, in %s:%d, dropping it.", 592 "A call to %s was tried in eval, in %s:%d, dropping it.",
595 current_function_name, ZSTR_VAL(filename), line_number); 593 current_function_name, ZSTR_VAL(filename), line_number);
596 zend_bailout();
597 } 594 }
598 efree(filename); 595 efree(filename);
599 } 596 }
@@ -644,16 +641,12 @@ zend_write_func_t zend_write_default = NULL;
644int hook_echo(const char* str, size_t str_length) { 641int hook_echo(const char* str, size_t str_length) {
645 zend_string* zs = zend_string_init(str, str_length, 0); 642 zend_string* zs = zend_string_init(str, str_length, 0);
646 643
647 bool ret = should_disable_ht( 644 should_disable_ht(
648 EG(current_execute_data), "echo", zs, NULL, 645 EG(current_execute_data), "echo", zs, NULL,
649 SNUFFLEUPAGUS_G(config).config_disabled_functions_reg->disabled_functions, 646 SNUFFLEUPAGUS_G(config).config_disabled_functions_reg->disabled_functions,
650 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked); 647 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked);
651 648
652 zend_string_release(zs); 649 zend_string_release(zs);
653 650
654 if (ret) {
655 zend_bailout();
656 }
657
658 return zend_write_default(str, str_length); 651 return zend_write_default(str, str_length);
659} 652}