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.
This commit is contained in:
Lennart Poettering
2025-07-02 16:25:06 +02:00
parent 7c8070c781
commit d3f04a6fa5
+1 -1
View File
@@ -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();