diff options
author | Tom Gundersen <teg@jklm.no> | 2014-09-18 19:02:03 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-09-18 19:02:42 +0200 |
commit | 6f5cf8a8b1de763383f7382821147e538b7dbd6d (patch) | |
tree | ff72e3f818ce1e2ae216ac13ebbdfd1d14a1b37a | |
parent | b1604b341bcd190d67894f416d842990a082a4a4 (diff) |
udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #1238780.
-rw-r--r-- | src/udev/udevd.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index cd517931d3..95c6468029 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1048,17 +1048,23 @@ static int parse_argv(int argc, char *argv[]) { arg_daemonize = true; break; case 'c': - safe_atoi(optarg, &arg_children_max); + r = safe_atoi(optarg, &arg_children_max); + if (r < 0) + log_warning("Invalid --children-max ignored: %s", optarg); break; case 'e': - safe_atoi(optarg, &arg_exec_delay); + r = safe_atoi(optarg, &arg_exec_delay); + if (r < 0) + log_warning("Invalid --exec-delay ignored: %s", optarg); break; case 't': r = safe_atou64(optarg, &arg_event_timeout_usec); if (r < 0) - break; - arg_event_timeout_usec *= USEC_PER_SEC; - arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1; + log_warning("Invalig --event-timeout ignored: %s", optarg); + else { + arg_event_timeout_usec *= USEC_PER_SEC; + arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1; + } break; case 'D': arg_debug = true; |