Blame SOURCES/0300-cryptsetup-don-t-assert-on-variable-which-is-optiona.patch
|
|
5d2ee9 |
From 5cdb2b0b2a0f8f89f97053b0633b8419506d4e28 Mon Sep 17 00:00:00 2001
|
|
|
5d2ee9 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
5d2ee9 |
Date: Thu, 1 Aug 2019 08:15:43 +0200
|
|
|
5d2ee9 |
Subject: [PATCH] cryptsetup: don't assert on variable which is optional
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
https://github.com/systemd/systemd/commit/50d2eba27b9bfc77ef6b40e5721713846815418b#commitcomment-34519739
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
In add_crypttab_devices() split_keyspec is called on the keyfile argument,
|
|
|
5d2ee9 |
which may be NULL.
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
(cherry picked from commit fef716b28be6e866b8afe995805d5ebe2af6bbfa)
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
Related: #1763155
|
|
|
5d2ee9 |
---
|
|
|
5d2ee9 |
src/cryptsetup/cryptsetup-generator.c | 6 +++++-
|
|
|
5d2ee9 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
|
|
|
5d2ee9 |
index 7b234e37be..a09983b576 100644
|
|
|
5d2ee9 |
--- a/src/cryptsetup/cryptsetup-generator.c
|
|
|
5d2ee9 |
+++ b/src/cryptsetup/cryptsetup-generator.c
|
|
|
5d2ee9 |
@@ -44,10 +44,14 @@ static int split_keyspec(const char *keyspec, char **ret_keyfile, char **ret_key
|
|
|
5d2ee9 |
_cleanup_free_ char *keyfile = NULL, *keydev = NULL;
|
|
|
5d2ee9 |
const char *c;
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
- assert(keyspec);
|
|
|
5d2ee9 |
assert(ret_keyfile);
|
|
|
5d2ee9 |
assert(ret_keydev);
|
|
|
5d2ee9 |
|
|
|
5d2ee9 |
+ if (!keyspec) {
|
|
|
5d2ee9 |
+ *ret_keyfile = *ret_keydev = NULL;
|
|
|
5d2ee9 |
+ return 0;
|
|
|
5d2ee9 |
+ }
|
|
|
5d2ee9 |
+
|
|
|
5d2ee9 |
c = strrchr(keyspec, ':');
|
|
|
5d2ee9 |
if (c) {
|
|
|
5d2ee9 |
keyfile = strndup(keyspec, c-keyspec);
|