From fa40064f0851b988478b283be4663ade1cf7f7e0 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 26 Oct 2017 13:39:33 +0200 Subject: Remove an arbitrary limitation --- src/sp_config_keywords.c | 9 ++------- src/sp_disabled_functions.c | 2 +- src/sp_utils.h | 2 ++ 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 604c2a1..3101ee1 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -235,23 +235,18 @@ int parse_disabled_functions(char *line) { if (pos) { errno = 0; char *endptr; - df->pos = strtol(pos, &endptr, 10); + df->pos = (int)strtol(pos, &endptr, 10); if (errno != 0 || endptr == pos) { sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu.", pos, sp_line_no); return -1; } - - // We'll never have a function with more than 128 params - if (df->pos > 128) { - df->pos = 128; - } } if (line_number) { errno = 0; char *endptr; - df->line = strtoul(line_number, &endptr, 10); + df->line = (unsigned int)strtoul(line_number, &endptr, 10); if (errno != 0 || endptr == line_number) { sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu.", line_number, sp_line_no); diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index f0b785c..0b1cc91 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c @@ -191,7 +191,7 @@ bool should_disable(zend_execute_data* execute_data) { "%d%s argument of the function '%s', but it takes only %d arguments. " "Matching on _all_ arguments instead.", config_node->pos, - (config_node->pos == 1)?"st":(config_node->pos)?"nd":"th", + GET_SUFFIX(config_node->pos), complete_path_function, nb_param); } else { i = config_node->pos; diff --git a/src/sp_utils.h b/src/sp_utils.h index 751b0b1..a17ac4f 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h @@ -51,6 +51,8 @@ #define sp_log_debug(...) #endif +#define GET_SUFFIX(x) (x==1)?"st":((x==2)?"nd":"th") + void sp_log_msg(char const *feature, char const *level, const char* fmt, ...); int compute_hash(const char *const filename, char *file_hash); char *sp_convert_to_string(zval *); -- cgit v1.3