代码拉取完成,页面将自动刷新
From 5cdb2b0b2a0f8f89f97053b0633b8419506d4e28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 1 Aug 2019 08:15:43 +0200
Subject: [PATCH] cryptsetup: don't assert on variable which is optional
https://github.com/systemd/systemd/commit/50d2eba27b9bfc77ef6b40e5721713846815418b#commitcomment-34519739
In add_crypttab_devices() split_keyspec is called on the keyfile argument,
which may be NULL.
(cherry picked from commit fef716b28be6e866b8afe995805d5ebe2af6bbfa)
Related: #1763155
---
src/cryptsetup/cryptsetup-generator.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 7b234e37be..a09983b576 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -44,10 +44,14 @@ static int split_keyspec(const char *keyspec, char **ret_keyfile, char **ret_key
_cleanup_free_ char *keyfile = NULL, *keydev = NULL;
const char *c;
- assert(keyspec);
assert(ret_keyfile);
assert(ret_keydev);
+ if (!keyspec) {
+ *ret_keyfile = *ret_keydev = NULL;
+ return 0;
+ }
+
c = strrchr(keyspec, ':');
if (c) {
keyfile = strndup(keyspec, c-keyspec);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。