From 90204792461030dbc8645d8511e7ac8d1b4f1ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 23 Apr 2021 12:40:07 +0200 Subject: [PATCH] core/service: also reject deserialized commands with no argv[0] I'm pretty sure that bad things would happen later on. --- src/core/service.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++) {