core: fix undefined behaviour due to uninitialized string buffer (#7597)

Failure of systemd to respond on the bus interface was bisected to af6b0ecc
"core: make "taint" string logic a bit more generic and output it at boot".

Failure was presumably caused by trying to append strings to an
unintialized buffer, leading to writing outside the unterminated buffer
and hence undefined behaviour.
This commit is contained in:
Alan Jenkins 2017-12-10 10:58:01 +00:00 committed by Yu Watanabe
parent f7757a4993
commit 0fd402b012

View file

@ -3886,6 +3886,7 @@ char *manager_taint_string(Manager *m) {
return NULL;
e = buf;
buf[0] = 0;
if (m->taint_usr)
e = stpcpy(e, "split-usr:");