summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorlaforge <laforge>2001-08-31 07:59:44 +0000
committerlaforge <laforge>2001-08-31 07:59:44 +0000
commit3fa0e61d5749529e93a6c799ffa0f15a02b831e0 (patch)
tree4dfd83010b15c4ae2807611ce2a21a624291d554 /extensions
parentde26d702b6589576253cc2c841158395e7acbfdb (diff)
bugfix and spelling corrections for psd match
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libipt_psd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/extensions/libipt_psd.c b/extensions/libipt_psd.c
index 21b9fb8..0b8b487 100644
--- a/extensions/libipt_psd.c
+++ b/extensions/libipt_psd.c
@@ -82,6 +82,12 @@ parse(int c, char **argv, int invert, unsigned int *flags,
{
struct ipt_psd_info *psdinfo = (struct ipt_psd_info *)(*match)->data;
unsigned int num;
+ char storage[sizeof(optarg) + 1];
+
+ /* string_to_number needs this */
+ storage[0] = ' ';
+ strncpy(&storage[1], optarg, (size_t) sizeof(optarg));
+ storage[sizeof(optarg)] = 0;
switch (c) {
/* PSD-weight-threshold */
@@ -90,7 +96,7 @@ parse(int c, char **argv, int invert, unsigned int *flags,
exit_error(PARAMETER_PROBLEM,
"Can't specify --psd-weight-threshold "
"twice");
- if (string_to_number(optarg, 0, 10000, &num) == -1)
+ if (string_to_number(storage, 0, 10000, &num) == -1)
exit_error(PARAMETER_PROBLEM,
"bad --psd-weight-threshold `%s'", optarg);
psdinfo->weight_threshold = num;
@@ -102,7 +108,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");
- if (string_to_number(optarg, 0, 10000, &num) == -1)
+ if (string_to_number(storage, 0, 10000, &num) == -1)
exit_error(PARAMETER_PROBLEM,
"bad --psd-delay-threshold `%s'", optarg);
psdinfo->delay_threshold = num;
@@ -114,7 +120,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");
- if (string_to_number(optarg, 0, 10000, &num) == -1)
+ if (string_to_number(storage, 0, 10000, &num) == -1)
exit_error(PARAMETER_PROBLEM,
"bad --psd-lo-ports-weight `%s'", optarg);
psdinfo->lo_ports_weight = num;
@@ -126,7 +132,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");
- if (string_to_number(optarg, 0, 10000, &num) == -1)
+ if (string_to_number(storage, 0, 10000, &num) == -1)
exit_error(PARAMETER_PROBLEM,
"bad --psd-hi-ports-weight `%s'", optarg);
psdinfo->hi_ports_weight = num;