From: Lennart Poettering Date: Sat, 24 Apr 2010 03:16:50 +0000 (+0200) Subject: main: refuse excess command line arguments X-Git-Tag: v1~437 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=51f0e18963df1058fff2869ec108526a08bc0e43;ds=sidebyside main: refuse excess command line arguments --- diff --git a/main.c b/main.c index d2721fd09..0128787d1 100644 --- a/main.c +++ b/main.c @@ -463,6 +463,15 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } + /* PID 1 will get the kernel arguments as parameters, which we + * ignore and unconditionally read from + * /proc/cmdline. However, we need to ignore those arguments + * here. */ + if (running_as != MANAGER_INIT && optind < argc) { + log_error("Excess arguments."); + return -EINVAL; + } + return 0; }