]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: also reject deserialized commands with no argv[0]
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Apr 2021 10:40:07 +0000 (12:40 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Apr 2021 13:12:38 +0000 (15:12 +0200)
I'm pretty sure that bad things would happen later on.

src/core/service.c

index f346e38b662da0c0f7c0248a11dc06caac02313b..d448d558db0fd8d20d265242b2dd9506b51aa7b9 100644 (file)
@@ -2790,13 +2790,14 @@ static int service_deserialize_exec_command(
                                 return -ENOMEM;
                         break;
                 default:
-                        assert_not_reached("Unknown error at deserialization of exec command");
-                        break;
+                        assert_not_reached("Logic error in exec command deserialization");
                 }
         }
 
         if (state != STATE_EXEC_COMMAND_ARGS)
                 return -EINVAL;
+        if (strv_isempty(argv))
+                return -EINVAL; /* At least argv[0] must be always present. */
 
         /* Let's check whether exec command on given offset matches data that we just deserialized */
         for (command = s->exec_command[id], i = 0; command; command = command->command_next, i++) {