summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-03-08 17:32:53 -0500
committerDave Reisner <dreisner@archlinux.org>2014-03-08 17:57:18 -0500
commit26abdc73a212b90f7c4b71808a1028d2e87ab09f (patch)
treef341ae81dbc7f6129359c988028a088ad0898abe
parentd5ce683c0780c02cf657be4f5cff506edf913f0a (diff)
fix off by one error in array index assertion
Since the index is already post-incremented when the array is appended to, this assertion can be wrongly reached when the array is at capacity (with the NULL terminator). The bug is reproducible on shutdown with the following settings in /etc/systemd/system.conf: LogTarget=journal-or-kmsg LogColor=yes LogLocation=yes Reported by Thermi on IRC.
-rw-r--r--src/core/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 6ebfe64187..f1b06d8880 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1994,7 +1994,7 @@ finish:
if (log_get_show_location())
command_line[pos++] = "--log-location";
- assert(pos + 1 < ELEMENTSOF(command_line));
+ assert(pos < ELEMENTSOF(command_line));
if (arm_reboot_watchdog && arg_shutdown_watchdog > 0) {
char *e;