summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_psd.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2001-08-31 07:59:44 +0000
committerHarald Welte <laforge@gnumonks.org>2001-08-31 07:59:44 +0000
commit6850af9a17ac0d141e92cb0fad14e30b9ed77273 (patch)
tree4dfd83010b15c4ae2807611ce2a21a624291d554 /extensions/libipt_psd.c
parent05e0b01bd1cd4035893c33c7084164bd8fab37c8 (diff)
bugfix and spelling corrections for psd match
Diffstat (limited to 'extensions/libipt_psd.c')
-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 21b9fb88..0b8b4870 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;