diff options
| author | jvoisin | 2017-10-26 13:39:33 +0200 |
|---|---|---|
| committer | jvoisin | 2017-10-26 13:39:33 +0200 |
| commit | fa40064f0851b988478b283be4663ade1cf7f7e0 (patch) | |
| tree | 30026a4e5fe7f2f3793c968ce321f4f2cc44d0ef /src | |
| parent | 5964129ff04d797081a0b24fb9683a909e1cc0e3 (diff) | |
Remove an arbitrary limitation
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_config_keywords.c | 9 | ||||
| -rw-r--r-- | src/sp_disabled_functions.c | 2 | ||||
| -rw-r--r-- | src/sp_utils.h | 2 |
3 files changed, 5 insertions, 8 deletions
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) { | |||
| 235 | if (pos) { | 235 | if (pos) { |
| 236 | errno = 0; | 236 | errno = 0; |
| 237 | char *endptr; | 237 | char *endptr; |
| 238 | df->pos = strtol(pos, &endptr, 10); | 238 | df->pos = (int)strtol(pos, &endptr, 10); |
| 239 | if (errno != 0 || endptr == pos) { | 239 | if (errno != 0 || endptr == pos) { |
| 240 | sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu.", | 240 | sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu.", |
| 241 | pos, sp_line_no); | 241 | pos, sp_line_no); |
| 242 | return -1; | 242 | return -1; |
| 243 | } | 243 | } |
| 244 | |||
| 245 | // We'll never have a function with more than 128 params | ||
| 246 | if (df->pos > 128) { | ||
| 247 | df->pos = 128; | ||
| 248 | } | ||
| 249 | } | 244 | } |
| 250 | 245 | ||
| 251 | if (line_number) { | 246 | if (line_number) { |
| 252 | errno = 0; | 247 | errno = 0; |
| 253 | char *endptr; | 248 | char *endptr; |
| 254 | df->line = strtoul(line_number, &endptr, 10); | 249 | df->line = (unsigned int)strtoul(line_number, &endptr, 10); |
| 255 | if (errno != 0 || endptr == line_number) { | 250 | if (errno != 0 || endptr == line_number) { |
| 256 | sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu.", | 251 | sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu.", |
| 257 | line_number, sp_line_no); | 252 | 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) { | |||
| 191 | "%d%s argument of the function '%s', but it takes only %d arguments. " | 191 | "%d%s argument of the function '%s', but it takes only %d arguments. " |
| 192 | "Matching on _all_ arguments instead.", | 192 | "Matching on _all_ arguments instead.", |
| 193 | config_node->pos, | 193 | config_node->pos, |
| 194 | (config_node->pos == 1)?"st":(config_node->pos)?"nd":"th", | 194 | GET_SUFFIX(config_node->pos), |
| 195 | complete_path_function, nb_param); | 195 | complete_path_function, nb_param); |
| 196 | } else { | 196 | } else { |
| 197 | i = config_node->pos; | 197 | 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 @@ | |||
| 51 | #define sp_log_debug(...) | 51 | #define sp_log_debug(...) |
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | #define GET_SUFFIX(x) (x==1)?"st":((x==2)?"nd":"th") | ||
| 55 | |||
| 54 | void sp_log_msg(char const *feature, char const *level, const char* fmt, ...); | 56 | void sp_log_msg(char const *feature, char const *level, const char* fmt, ...); |
| 55 | int compute_hash(const char *const filename, char *file_hash); | 57 | int compute_hash(const char *const filename, char *file_hash); |
| 56 | char *sp_convert_to_string(zval *); | 58 | char *sp_convert_to_string(zval *); |
