executor: return instead of assert on invalid command line arguments

Before the split, it made sense to assert, as checks were on setup.
But now these come from deserialization, and the fuzzer hits the
asserts, so simply return an error instead.
This commit is contained in:
Luca Boccassi
2023-10-20 01:00:36 +01:00
committed by Luca Boccassi
parent 974959e6f6
commit 856bed0abe
+8 -2
View File
@@ -3914,8 +3914,14 @@ int exec_invoke(
assert(exit_status);
/* Explicitly test for CVE-2021-4034 inspired invocations */
assert(command->path);
assert(!strv_isempty(command->argv));
if (!command->path || strv_isempty(command->argv)) {
*exit_status = EXIT_EXEC;
return log_exec_error_errno(
context,
params,
SYNTHETIC_ERRNO(EINVAL),
"Invalid command line arguments.");
}
LOG_CONTEXT_PUSH_EXEC(context, params);