diff options
author | Jan Alexander Steffens <jan.steffens@gmail.com> | 2017-12-18 14:47:18 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-12-18 14:47:18 +0100 |
commit | aff0b1fa7bf2ca60fd5ffdf7ea25184d576cf61d (patch) | |
tree | 69936d9de7a0145cc58f59a2c259c82648b8248f /src | |
parent | 4dfdca3148ac9ecba9ea1ff16b75d514dc00e2bc (diff) | |
download | systemd-aff0b1fa7bf2ca60fd5ffdf7ea25184d576cf61d.tar.gz systemd-aff0b1fa7bf2ca60fd5ffdf7ea25184d576cf61d.tar.bz2 systemd-aff0b1fa7bf2ca60fd5ffdf7ea25184d576cf61d.zip |
cryptsetup-generator: Don't mistake NULL input as OOM (#7688)
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
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 531edc6847..b41faed6ad 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -107,7 +107,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(); r = generator_open_unit_file(arg_dest, NULL, n, &f); @@ -177,7 +177,7 @@ static int create_disk( return r; filtered_escaped = specifier_escape(filtered); - if (!filtered_escaped) + if (filtered && !filtered_escaped) return log_oom(); fprintf(f, |