]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
bugfix and spelling corrections for psd match
authorHarald Welte <laforge@gnumonks.org>
Fri, 31 Aug 2001 07:59:44 +0000 (07:59 +0000)
committerHarald Welte <laforge@gnumonks.org>
Fri, 31 Aug 2001 07:59:44 +0000 (07:59 +0000)
extensions/libipt_psd.c

index 21b9fb884f0318091805f62ff320f8055de00e3b..0b8b4870d4ed97475b97009ed83555a5f31df8b3 100644 (file)
@@ -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;