From 1c3727108414e3167d5653f9e78430678f6707c8 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 22 Nov 2023 06:54:18 +0900
Subject: [PATCH] pid1: terminate cylon string

Fixes #30121.

(cherry picked from commit 0fe9604359d6a40fe064dbb19161a9f26a4d4198)
(cherry picked from commit 337107883cc867a0cdabed4e1d06ba4f2b1cc63a)
(cherry picked from commit 449fdb3156f5b17f0dfd3c1cfcba028670e121b3)

Conflict:NA
Reference:https://github.com/systemd/systemd/commit/0fe9604359d6a40fe064dbb19161a9f26a4d4198
---
 src/core/manager.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/core/manager.c b/src/core/manager.c
index dbdee9053c..6357d3b625 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -196,8 +196,10 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
                 if (pos < width-1)
                         p = mempset(p, ' ', width-1-pos);
                 if (log_get_show_color())
-                        strcpy(p, ANSI_NORMAL);
+                        p = stpcpy(p, ANSI_NORMAL);
         }
+
+        *p = '\0';
 }
 
 static void manager_flip_auto_status(Manager *m, bool enable, const char *reason) {
-- 
2.33.0

