From 42418fdd99a907cd0f35e07894d803815505184d Mon Sep 17 00:00:00 2001 From: rusty Date: Sun, 27 Aug 2000 07:41:39 +0000 Subject: Jan Echternach's string_to_number bignum fixes. --- ip6tables.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ip6tables.c') diff --git a/ip6tables.c b/ip6tables.c index 27e7187..4df70c8 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -745,14 +745,15 @@ parse_target(const char *targetname) int string_to_number(const char *s, int min, int max) { - int number; + long number; char *end; /* Handle hex, octal, etc. */ - number = (int)strtol(s, &end, 0); + errno = 0; + number = strtol(s, &end, 0); if (*end == '\0' && end != s) { /* we parsed a number, let's see if we want this */ - if (min <= number && number <= max) + if (errno != ERANGE && min <= number && number <= max) return number; } return -1; @@ -818,7 +819,7 @@ find_target(const char *name, enum ip6t_tryload tryload) } static struct option * -merge_options(struct option *oldopts, struct option *newopts, +merge_options(struct option *oldopts, const struct option *newopts, unsigned int *option_offset) { unsigned int num_old, num_new, i; -- cgit v1.2.3