From: Zbigniew Jędrzejewski-Szmek Date: Fri, 23 Apr 2021 10:40:07 +0000 (+0200) Subject: core/service: also reject deserialized commands with no argv[0] X-Git-Tag: v249-rc1~342^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90204792461030dbc8645d8511e7ac8d1b4f1ca2;p=thirdparty%2Fsystemd.git core/service: also reject deserialized commands with no argv[0] I'm pretty sure that bad things would happen later on. --- diff --git a/src/core/service.c b/src/core/service.c index f346e38b662..d448d558db0 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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++) {