summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Alexander Steffens <jan.steffens@gmail.com>2017-12-18 14:47:18 +0100
committerLuke Shumaker <lukeshu@lukeshu.com>2017-12-21 16:02:09 -0500
commit506dad1b1c2a0f673714176d5076619737ba9d7e (patch)
tree2fb483e6f02de175855b7de0d598c945be7248a2
parenta1b2c92d8290c76a29ccd0887a92ac064e1bb5a1 (diff)
cryptsetup-generator: Don't mistake NULL input as OOM (#7688)systemd/v236.0-2
Since systemd v236, several Arch users complained that systemd-cryptsetup-generator exits with an OOM error and that it prevents the boot from continuing. Investigating the diff of cryptsetup-generator between v235 and v236 I noticed that create_disk allowed for the `password` and `filtered` variables to be NULL (they're handled with `strempty()`) but not their `*_escaped` versions, and returned OOM errors in those cases. Fix this by checking that the input string is non-NULL before deciding that `specifier_escape` had an OOM error. I could not test this fix myself, but some users have reported success. Downstream bug: https://bugs.archlinux.org/task/56733 (cherry picked from commit aff0b1fa7bf2ca60fd5ffdf7ea25184d576cf61d)
-rw-r--r--src/cryptsetup/cryptsetup-generator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 7e61332e52..f914513536 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -111,7 +111,7 @@ static int create_disk(
return log_error_errno(r, "Failed to generate unit name: %m");
password_escaped = specifier_escape(password);
- if (!password_escaped)
+ if (password && !password_escaped)
return log_oom();
f = fopen(p, "wxe");
@@ -184,7 +184,7 @@ static int create_disk(
return r;
filtered_escaped = specifier_escape(filtered);
- if (!filtered_escaped)
+ if (filtered && !filtered_escaped)
return log_oom();
fprintf(f,