diff options
author | Daniel Mack <github@zonque.org> | 2015-09-05 14:33:56 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-09-05 14:33:56 +0200 |
commit | c7430c3d1a0c14aed631864b9da504ba1a9352c2 (patch) | |
tree | 0e3cb2101e50319b5518a7f78b6034442a05bc4c /src | |
parent | a2b8814fa6b970181b71ca61e1de58cae137a7cb (diff) | |
parent | 3d1c455f9a898e7427b642800644ae7142dc7557 (diff) |
Merge pull request #1157 from dvdhrm/logind-wallfix
login: fix NULL-deref on wall_message
Diffstat (limited to 'src')
-rw-r--r-- | src/login/logind-dbus.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 7cc68d4865..e433549cb9 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -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); |