]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_LED: guard against negative numbers
authorJan Engelhardt <jengelh@inai.de>
Sun, 15 Jul 2012 20:21:00 +0000 (22:21 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 31 Jul 2012 11:32:22 +0000 (13:32 +0200)
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
extensions/libxt_LED.c

index 9d68fa2754803c7141f4754d2b936bad3328dc13..e6cf849764256651c17e9e9e3bb3037318f2b993 100644 (file)
@@ -49,6 +49,7 @@ static void LED_help(void)
 static void LED_parse(struct xt_option_call *cb)
 {
        struct xt_led_info *led = cb->data;
+       unsigned int delay;
 
        xtables_option_parse(cb);
        switch (cb->entry->id) {
@@ -59,8 +60,10 @@ static void LED_parse(struct xt_option_call *cb)
        case O_LED_DELAY:
                if (strncasecmp(cb->arg, "inf", 3) == 0)
                        led->delay = -1;
-               else
-                       led->delay = strtoul(cb->arg, NULL, 0);
+               else if (!xtables_strtoui(cb->arg, NULL, &delay, 0, UINT32_MAX))
+                       xtables_error(PARAMETER_PROBLEM,
+                               "Delay value must be within range 0..%u",
+                               UINT32_MAX);
                break;
        case O_LED_ALWAYS_BLINK:
                led->always_blink = 1;