From: Lennart Poettering Date: Wed, 2 Jul 2025 14:25:00 +0000 (+0200) Subject: logind: use memdup_suffix0() where appropiate X-Git-Tag: v258-rc1~212^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3f04a6fa541280a8a205a3d4d2313a043b7a32d;p=thirdparty%2Fsystemd.git 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. --- 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();