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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user