From: Zbigniew Jędrzejewski-Szmek Date: Sat, 25 Mar 2023 10:58:49 +0000 (+0100) Subject: core/main: restore the correct assert about array position X-Git-Tag: v254-rc1~922 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14ecfc1cd2e8050214b56cf3588740e20666b3cd;p=thirdparty%2Fsystemd.git core/main: restore the correct assert about array position 'pos' is incremented after each assignment. If we use the maximum number of arguments, we end up with pos==9 after all the assignments, and it points to where the next value would be assigned. This position must remain NULL. The assert I "fixed" was intentionally introduced in 26abdc73a212b90f7c4b71808a1028d2e87ab09f as a bugfix. So my "fix" repeated the same error that was fixed back then. --- diff --git a/src/core/main.c b/src/core/main.c index 3d7b2a5f649..88bef6740cc 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1572,7 +1572,7 @@ static int become_shutdown(int objective, int retval) { command_line[pos++] = exit_code; } - assert(pos < ELEMENTSOF(command_line) - 1); + assert(pos < ELEMENTSOF(command_line)); /* The watchdog: */