summaryrefslogtreecommitdiffstats
path: root/iptables.c
diff options
context:
space:
mode:
authorJan Echternach <echter@informatik.uni-rostock.de>2000-08-26 04:44:39 +0000
committerRusty Russell <rusty@rustcorp.com.au>2000-08-26 04:44:39 +0000
commit5a1041dfbeffa3703ba1dca73b8a563605888ae3 (patch)
tree57e16c85f86f2b9e6acb0ec99bdfaa3e2351eb90 /iptables.c
parent14a1c9175257f73e936a68ba68d3541278c0e52a (diff)
Jan Echternach's patch for bignums
Diffstat (limited to 'iptables.c')
-rw-r--r--iptables.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/iptables.c b/iptables.c
index 4dfa7d04..92f0175d 100644
--- a/iptables.c
+++ b/iptables.c
@@ -820,14 +820,15 @@ mask_to_dotted(const struct in_addr *mask)
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;
@@ -894,7 +895,7 @@ find_target(const char *name, enum ipt_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;