summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorjvoisin2017-10-10 18:11:31 +0200
committerjvoisin2017-10-18 15:27:21 +0200
commitfe43991e3dc6c46e2781d21369f5e268de7baef9 (patch)
tree027471bdcce37397c4b39b6f9fbf252104a2ebde /src/sp_disabled_functions.c
parente8d255e5cef8949256d3290b2d8fd22de9428a83 (diff)
Implement match on arguments position
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index c8c723a..b05d949 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -178,11 +178,17 @@ bool should_disable(zend_execute_data* execute_data) {
178 } 178 }
179 179
180 /* Check if we filter on parameter value*/ 180 /* Check if we filter on parameter value*/
181 if (config_node->param || config_node->r_param) { 181 if (config_node->param || config_node->r_param || (config_node->pos != -1)) {
182 const unsigned int nb_param = execute_data->func->common.num_args; 182 unsigned int nb_param = execute_data->func->common.num_args;
183 bool arg_matched = false; 183 bool arg_matched = false;
184 int i = 0;
184 185
185 for (unsigned int i = 0; i < nb_param; i++) { 186 if (config_node->pos != -1) {//&& nb_param <= config_node->pos) {
187 i = config_node->pos;
188 nb_param = (config_node->pos) + 1;
189 }
190
191 for (; i < nb_param; i++) {
186 arg_matched = false; 192 arg_matched = false;
187 if (ZEND_USER_CODE(execute_data->func->type)) { // yay consistency 193 if (ZEND_USER_CODE(execute_data->func->type)) { // yay consistency
188 arg_name = ZSTR_VAL(execute_data->func->common.arg_info[i].name); 194 arg_name = ZSTR_VAL(execute_data->func->common.arg_info[i].name);
@@ -197,7 +203,7 @@ bool should_disable(zend_execute_data* execute_data) {
197 (true == is_regexp_matching(config_node->r_param, arg_name)); 203 (true == is_regexp_matching(config_node->r_param, arg_name));
198 204
199 /* This is the parameter name we're looking for. */ 205 /* This is the parameter name we're looking for. */
200 if (true == arg_matching || true == pcre_matching) { 206 if (true == arg_matching || true == pcre_matching || (config_node->pos != -1)) {
201 zval* arg_value = ZEND_CALL_VAR_NUM(execute_data, i); 207 zval* arg_value = ZEND_CALL_VAR_NUM(execute_data, i);
202 208
203 if (config_node->param_type) { // Are we matching on the `type`? 209 if (config_node->param_type) { // Are we matching on the `type`?