mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
login: fix NULL-deref on wall_message
We treat an empty wall-message equal to a NULL wall-message since:
commit 5744f59a3e
Author: Lennart Poettering <lennart@poettering.net>
Date: Fri Sep 4 10:34:47 2015 +0200
logind: treat an empty wall message like a NULL one
Fix the shutdown scheduler to not deref a NULL pointer, but properly
check for an empty wall-message.
Fixes: #1120
This commit is contained in:
parent
c9912c5eaf
commit
3d1c455f9a
@ -1796,9 +1796,11 @@ static int update_schedule_file(Manager *m) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create shutdown subdirectory: %m");
|
||||
|
||||
t = cescape(m->wall_message);
|
||||
if (!t)
|
||||
return log_oom();
|
||||
if (!isempty(m->wall_message)) {
|
||||
t = cescape(m->wall_message);
|
||||
if (!t)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
r = fopen_temporary("/run/systemd/shutdown/scheduled", &f, &temp_path);
|
||||
if (r < 0)
|
||||
@ -1814,7 +1816,7 @@ static int update_schedule_file(Manager *m) {
|
||||
m->enable_wall_messages,
|
||||
m->scheduled_shutdown_type);
|
||||
|
||||
if (!isempty(m->wall_message))
|
||||
if (t)
|
||||
fprintf(f, "WALL_MESSAGE=%s\n", t);
|
||||
|
||||
r = fflush_and_check(f);
|
||||
|
Loading…
Reference in New Issue
Block a user