chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
login: fix NULL-deref on wall_message
[elogind.git]
/
src
/
login
/
logind-dbus.c
diff --git
a/src/login/logind-dbus.c
b/src/login/logind-dbus.c
index cdb3007ac0b823c17172e03529948124fb6ae55b..def9f3927474a212495bee9aaf41faca053b8f91 100644
(file)
--- a/
src/login/logind-dbus.c
+++ b/
src/login/logind-dbus.c
@@
-1783,9
+1783,11
@@
static int update_schedule_file(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to create shutdown subdirectory: %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)
r = fopen_temporary("/run/systemd/shutdown/scheduled", &f, &temp_path);
if (r < 0)
@@
-1801,7
+1803,7
@@
static int update_schedule_file(Manager *m) {
m->enable_wall_messages,
m->scheduled_shutdown_type);
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);
fprintf(f, "WALL_MESSAGE=%s\n", t);
r = fflush_and_check(f);