diff options
author | Harald Welte <laforge@gnumonks.org> | 2001-07-23 02:14:22 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2001-07-23 02:14:22 +0000 |
commit | b47197629735fa1cb93112dfd7d1c4fbcdb24a95 (patch) | |
tree | 6b34d5dfc6bca2aff38c5e6f406c0f1700fe8836 /extensions/libipt_psd.c | |
parent | ed498493949c34e4b3292e93b41cda6776b7915e (diff) |
further fixes of string_to_number fixes
Diffstat (limited to 'extensions/libipt_psd.c')
-rw-r--r-- | extensions/libipt_psd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/extensions/libipt_psd.c b/extensions/libipt_psd.c index f6885025..d5bb87e8 100644 --- a/extensions/libipt_psd.c +++ b/extensions/libipt_psd.c @@ -81,7 +81,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, struct ipt_entry_match **match) { struct ipt_psd_info *psdinfo = (struct ipt_psd_info *)(*match)->data; - int num; + unsigned int num; switch (c) { /* PSD-weight-threshold */ @@ -90,8 +90,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "Can't specify --psd-weight-threshold " "twice"); - num = string_to_number(optarg, 0, 10000); - if (num <= 0) + if (string_to_number(optarg, 0, 10000, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --psd-weight-threshold `%s'", optarg); psdinfo->weight_threshold = num; @@ -103,8 +102,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & IPT_PSD_OPT_DTRESH) exit_error(PARAMETER_PROBLEM, "Can't specify --psd-delay-threshold twice"); - num = string_to_number(optarg, 0, 10000); - if (num <= 0) + if (string_to_number(optarg, 0, 10000, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --psd-delay-threshold `%s'", optarg); psdinfo->delay_threshold = num; @@ -116,8 +114,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & IPT_PSD_OPT_LPWEIGHT) exit_error(PARAMETER_PROBLEM, "Can't specify --psd-lo-ports-weight twice"); - num = string_to_number(optarg, 0, 10000); - if (num <= 0) + if (string_to_number(optarg, 0, 10000, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --psd-lo-ports-weight `%s'", optarg); psdinfo->lo_ports_weight = num; @@ -129,8 +126,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (*flags & IPT_PSD_OPT_HPWEIGHT) exit_error(PARAMETER_PROBLEM, "Can't specify --psd-hi-ports-weight twice"); - num = string_to_number(optarg, 0, 10000); - if (num <= 0) + if (string_to_number(optarg, 0, 10000, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --psd-hi-ports-weight `%s'", optarg); psdinfo->hi_ports_weight = num; |