core/service: also reject deserialized commands with no argv[0]

I'm pretty sure that bad things would happen later on.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-04-23 15:12:38 +02:00
parent 1a128a468d
commit 9020479246
+3 -2
View 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++) {