From d3f04a6fa541280a8a205a3d4d2313a043b7a32d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 Jul 2025 16:25:00 +0200 Subject: [PATCH] logind: use memdup_suffix0() where appropiate memdup_suffix0() is the call of choice when we are dealing with an input that might not be NUL terminated. strndup() assumes NUL termination. --- src/login/logind-utmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c index 8305ae743fa..8f6914f7250 100644 --- a/src/login/logind-utmp.c +++ b/src/login/logind-utmp.c @@ -43,7 +43,7 @@ int manager_read_utmp(Manager *m) { if (!pid_is_valid(u->ut_pid)) continue; - t = strndup(u->ut_line, sizeof(u->ut_line)); + t = memdup_suffix0(u->ut_line, sizeof(u->ut_line)); if (!t) return log_oom(); -- 2.47.3