summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-12-14 14:29:43 +0100
committerBen Fuhrmannek2021-12-14 14:29:43 +0100
commit4a45ba42b609d48c8297456d67cc8d955073b567 (patch)
tree947bd03955cd9e8c141f133ab12d3a84bd62611e /src/sp_disabled_functions.c
parent1746eb1013af60d8524a42fb3431446a5933a646 (diff)
fix: include class name in eval whitelist matching
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index 216f696..1d9c6c7 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -512,19 +512,13 @@ static void hook_functions(HashTable* to_hook_ht, HashTable* hooked_ht) {
512 512
513ZEND_FUNCTION(eval_blacklist_callback) { 513ZEND_FUNCTION(eval_blacklist_callback) {
514 zif_handler orig_handler; 514 zif_handler orig_handler;
515 const char* current_function_name = get_active_function_name(TSRMLS_C); 515 char* current_function_name = get_complete_function_path(EG(current_execute_data));
516 zend_string* tmp =
517 zend_string_init(current_function_name, strlen(current_function_name), 0);
518 516
519 if (true == check_is_in_eval_whitelist(tmp)) { 517 if (!current_function_name || true == check_is_in_eval_whitelist(current_function_name)) {
520 zend_string_release(tmp);
521 goto whitelisted; 518 goto whitelisted;
522 } 519 }
523 zend_string_release(tmp);
524 520
525 if (SPG(in_eval) > 0) { 521 if (SPG(in_eval) > 0) {
526 // zend_string* filename = get_eval_filename(zend_get_executed_filename());
527 // const int line_number = zend_get_executed_lineno(TSRMLS_C);
528 const sp_config_eval* config_eval = &(SPCFG(eval)); 522 const sp_config_eval* config_eval = &(SPCFG(eval));
529 523
530 if (config_eval->dump) { 524 if (config_eval->dump) {
@@ -535,13 +529,12 @@ ZEND_FUNCTION(eval_blacklist_callback) {
535 } else { 529 } else {
536 sp_log_drop("eval", "A call to '%s' was tried in eval. dropping it.", current_function_name); 530 sp_log_drop("eval", "A call to '%s' was tried in eval. dropping it.", current_function_name);
537 } 531 }
538 // efree(filename);
539 } 532 }
540 533
541whitelisted: 534whitelisted:
542 orig_handler = zend_hash_str_find_ptr( 535
543 SPG(sp_eval_blacklist_functions_hook), current_function_name, 536 orig_handler = zend_hash_str_find_ptr(SPG(sp_eval_blacklist_functions_hook), current_function_name, strlen(current_function_name));
544 strlen(current_function_name)); 537 efree(current_function_name);
545 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); 538 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
546} 539}
547 540