]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: fix undefined behaviour due to uninitialized string buffer (#7597)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Sun, 10 Dec 2017 10:58:01 +0000 (10:58 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 10 Dec 2017 10:58:01 +0000 (19:58 +0900)
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.

src/core/manager.c

index 6cf7fd3f303a2ba333c7a6f0b6f1a7b74143b018..0681bbbbd240eac35367967806e61dd9a87ea687 100644 (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:");