]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
executor: return instead of assert on invalid command line arguments
authorLuca Boccassi <bluca@debian.org>
Thu, 19 Oct 2023 19:53:10 +0000 (20:53 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 20 Oct 2023 00:00:36 +0000 (01:00 +0100)
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.

src/core/exec-invoke.c

index c6ef2953c8d846b8295da495e468f194ff13af0b..02d6af29f88fdce4359c0ff977988d75822f83c2 100644 (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);