diff options
author | Tom Gundersen <teg@jklm.no> | 2014-09-18 19:02:03 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-09-18 18:50:45 -0400 |
commit | 2f7510f3124e48fecd3a9f59749c33ae05041ec6 (patch) | |
tree | aa78c32e4723d5a68f90b4d8a1d6282d4eee648a | |
parent | a580624ac3f9c49e94b0ff97c6df459b87d6afac (diff) |
udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #1238780.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-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 cd94724f54..43852528b2 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1075,17 +1075,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; |