diff options
| author | Ben Fuhrmannek | 2020-06-15 11:50:13 +0200 |
|---|---|---|
| committer | jvoisin | 2022-03-20 18:10:14 +0100 |
| commit | 83b01942dfc80474cc05e09aeef4b44307a7120b (patch) | |
| tree | 5137ab241d23637278e91b78e13878271a370e5d /src | |
| parent | ab1154af363065e090f2b2afcf589d140c2f83ea (diff) | |
fixed trigger logic to parameter matching
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_disabled_functions.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 6a559c8..c47b5cb 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c | |||
| @@ -101,8 +101,8 @@ static bool is_local_var_matching( | |||
| 101 | static bool is_param_matching(zend_execute_data* execute_data, | 101 | static bool is_param_matching(zend_execute_data* execute_data, |
| 102 | sp_disabled_function const* const config_node, | 102 | sp_disabled_function const* const config_node, |
| 103 | const zend_string* builtin_param, | 103 | const zend_string* builtin_param, |
| 104 | const char** arg_name, | ||
| 105 | const char* builtin_param_name, | 104 | const char* builtin_param_name, |
| 105 | const char** arg_name, | ||
| 106 | const zend_string** arg_value_str) { | 106 | const zend_string** arg_value_str) { |
| 107 | int nb_param = ZEND_CALL_NUM_ARGS(execute_data); | 107 | int nb_param = ZEND_CALL_NUM_ARGS(execute_data); |
| 108 | int i = 0; | 108 | int i = 0; |
| @@ -312,11 +312,13 @@ static void should_disable(zend_execute_data* execute_data, | |||
| 312 | goto next; | 312 | goto next; |
| 313 | } | 313 | } |
| 314 | } | 314 | } |
| 315 | |||
| 315 | if (config_node->line) { | 316 | if (config_node->line) { |
| 316 | if (config_node->line != zend_get_executed_lineno()) { | 317 | if (config_node->line != zend_get_executed_lineno()) { |
| 317 | goto next; | 318 | goto next; |
| 318 | } | 319 | } |
| 319 | } | 320 | } |
| 321 | |||
| 320 | if (config_node->filename || config_node->r_filename) { | 322 | if (config_node->filename || config_node->r_filename) { |
| 321 | zend_execute_data* ex = | 323 | zend_execute_data* ex = |
| 322 | is_file_matching(execute_data, config_node, current_filename); | 324 | is_file_matching(execute_data, config_node, current_filename); |
| @@ -331,6 +333,7 @@ static void should_disable(zend_execute_data* execute_data, | |||
| 331 | goto next; | 333 | goto next; |
| 332 | } | 334 | } |
| 333 | } | 335 | } |
| 336 | |||
| 334 | if (config_node->var) { | 337 | if (config_node->var) { |
| 335 | if (false == is_local_var_matching(execute_data, config_node)) { | 338 | if (false == is_local_var_matching(execute_data, config_node)) { |
| 336 | goto next; | 339 | goto next; |
| @@ -349,7 +352,8 @@ static void should_disable(zend_execute_data* execute_data, | |||
| 349 | 352 | ||
| 350 | /* Check if we filter on parameter value*/ | 353 | /* Check if we filter on parameter value*/ |
| 351 | if (config_node->param || config_node->r_param || | 354 | if (config_node->param || config_node->r_param || |
| 352 | (config_node->pos != -1)) { | 355 | (config_node->pos != -1) || |
| 356 | ((config_node->r_value || config_node->value) && !config_node->var)) { | ||
| 353 | if (!builtin_param && | 357 | if (!builtin_param && |
| 354 | #if PHP_VERSION_ID >= 80000 | 358 | #if PHP_VERSION_ID >= 80000 |
| 355 | ZEND_ARG_IS_VARIADIC(execute_data->func->op_array.arg_info) | 359 | ZEND_ARG_IS_VARIADIC(execute_data->func->op_array.arg_info) |
| @@ -363,24 +367,12 @@ static void should_disable(zend_execute_data* execute_data, | |||
| 363 | "Check https://github.com/jvoisin/snuffleupagus/issues/164 for " | 367 | "Check https://github.com/jvoisin/snuffleupagus/issues/164 for " |
| 364 | "details."); | 368 | "details."); |
| 365 | } else if (false == is_param_matching( | 369 | } else if (false == is_param_matching( |
| 366 | execute_data, config_node, builtin_param, | 370 | execute_data, config_node, builtin_param, builtin_param_name, |
| 367 | &arg_name, builtin_param_name, &arg_value_str)) { | 371 | &arg_name, &arg_value_str)) { |
| 368 | goto next; | 372 | goto next; |
| 369 | } | 373 | } |
| 370 | } | 374 | } |
| 371 | 375 | ||
| 372 | if (config_node->r_value || config_node->value) { | ||
| 373 | if (check_is_builtin_name(config_node) && !config_node->var && | ||
| 374 | !config_node->key && !config_node->r_key && !config_node->param && | ||
| 375 | !config_node->r_param) { | ||
| 376 | if (false == is_param_matching(execute_data, config_node, builtin_param, | ||
| 377 | &arg_name, builtin_param_name, | ||
| 378 | &arg_value_str)) { | ||
| 379 | goto next; | ||
| 380 | } | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | /* Everything matched.*/ | 376 | /* Everything matched.*/ |
| 385 | if (true == config_node->allow) { | 377 | if (true == config_node->allow) { |
| 386 | return; | 378 | return; |
