summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorjvoisin2018-10-06 16:15:00 +0000
committerGitHub2018-10-06 16:15:00 +0000
commitaa550b9abadc109a2c89a7cd6dd047ac2a953027 (patch)
tree1892e9ce8f833f3f13278cd424368fe1b5e26d91 /src/sp_disabled_functions.c
parent228fadf307b167a22ad6ec760f3b2ee2e9f2fee3 (diff)
Bump a bit the coverage
* `setcookie` doesn't always return `true` anymore * clang-format * Cookies with invalid decryption are dropped, but the request isn't anymore * faulty unserialize are now dumpable
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index 1589cd4..79dc5a7 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -106,12 +106,12 @@ static bool is_param_matching(zend_execute_data* execute_data,
106 if (config_node->pos > nb_param - 1) { 106 if (config_node->pos > nb_param - 1) {
107 char* complete_function_path = get_complete_function_path(execute_data); 107 char* complete_function_path = get_complete_function_path(execute_data);
108 sp_log_warn("config", 108 sp_log_warn("config",
109 "It seems that you wrote a rule filtering on the " 109 "It seems that you wrote a rule filtering on the "
110 "%d%s argument of the function '%s', but it takes only %d " 110 "%d%s argument of the function '%s', but it takes only %d "
111 "arguments. " 111 "arguments. "
112 "Matching on _all_ arguments instead.", 112 "Matching on _all_ arguments instead.",
113 config_node->pos, GET_SUFFIX(config_node->pos), 113 config_node->pos, GET_SUFFIX(config_node->pos),
114 complete_function_path, nb_param); 114 complete_function_path, nb_param);
115 efree(complete_function_path); 115 efree(complete_function_path);
116 } else { 116 } else {
117 i = config_node->pos; 117 i = config_node->pos;
@@ -209,12 +209,12 @@ static zend_execute_data* is_file_matching(
209 zend_execute_data* ex = execute_data; 209 zend_execute_data* ex = execute_data;
210 if (config_node->filename) { 210 if (config_node->filename) {
211 if (sp_zend_string_equals(current_filename, config_node->filename)) { 211 if (sp_zend_string_equals(current_filename, config_node->filename)) {
212 return ex; 212 return ex; // LCOV_EXCL_LINE
213 } 213 }
214 ITERATE(ex); 214 ITERATE(ex);
215 if (zend_string_equals(ex->func->op_array.filename, 215 if (zend_string_equals(ex->func->op_array.filename,
216 config_node->filename)) { 216 config_node->filename)) {
217 return ex; 217 return ex; // LCOV_EXCL_LINE
218 } 218 }
219 } else if (config_node->r_filename) { 219 } else if (config_node->r_filename) {
220 if (sp_is_regexp_matching_zend(config_node->r_filename, current_filename)) { 220 if (sp_is_regexp_matching_zend(config_node->r_filename, current_filename)) {
@@ -415,8 +415,8 @@ bool should_drop_on_ret_ht(const zval* return_value, const char* function_name,
415 415
416 ht_entry = zend_hash_str_find_ptr(ht, function_name, strlen(function_name)); 416 ht_entry = zend_hash_str_find_ptr(ht, function_name, strlen(function_name));
417 417
418 if (ht_entry && should_drop_on_ret(return_value, ht_entry, function_name, 418 if (ht_entry &&
419 execute_data)) { 419 should_drop_on_ret(return_value, ht_entry, function_name, execute_data)) {
420 ret = true; 420 ret = true;
421 } else if (config && config->data) { 421 } else if (config && config->data) {
422 ret = should_drop_on_ret(return_value, config, function_name, execute_data); 422 ret = should_drop_on_ret(return_value, config, function_name, execute_data);
@@ -516,13 +516,12 @@ ZEND_FUNCTION(check_disabled_function) {
516 SNUFFLEUPAGUS_G(disabled_functions_hook), current_function_name, 516 SNUFFLEUPAGUS_G(disabled_functions_hook), current_function_name,
517 strlen(current_function_name)); 517 strlen(current_function_name));
518 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); 518 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
519 if (true == 519 if (true == should_drop_on_ret_ht(
520 should_drop_on_ret_ht( 520 return_value, current_function_name,
521 return_value, current_function_name, 521 SNUFFLEUPAGUS_G(config)
522 SNUFFLEUPAGUS_G(config) 522 .config_disabled_functions_reg_ret->disabled_functions,
523 .config_disabled_functions_reg_ret->disabled_functions, 523 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked,
524 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, 524 execute_data)) {
525 execute_data)) {
526 zend_bailout(); 525 zend_bailout();
527 } 526 }
528} 527}
@@ -584,7 +583,7 @@ ZEND_FUNCTION(eval_blacklist_callback) {
584 583
585 if (config_eval->dump) { 584 if (config_eval->dump) {
586 sp_log_request(config_eval->dump, config_eval->textual_representation, 585 sp_log_request(config_eval->dump, config_eval->textual_representation,
587 SP_TOKEN_EVAL_BLACKLIST); 586 SP_TOKEN_EVAL_BLACKLIST);
588 } 587 }
589 if (config_eval->simulation) { 588 if (config_eval->simulation) {
590 sp_log_msg("eval", SP_LOG_SIMULATION, 589 sp_log_msg("eval", SP_LOG_SIMULATION,