加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-shared-bootspec-avoid-crashing-on-config-without-a-v.patch 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
hongjinghao 提交于 2023-06-19 10:57 . sync patches from systemd community
From 412b89a6e8055f2c8c9db4b6b847f081e00461ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 6 May 2022 17:36:47 +0200
Subject: [PATCH] shared/bootspec: avoid crashing on config without a value
(cherry picked from commit b6bd2562ebb01b48cdb55a970d9daa1799b59876)
---
src/shared/bootspec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
index 0076092c2a..9e2b2899bd 100644
--- a/src/shared/bootspec.c
+++ b/src/shared/bootspec.c
@@ -124,6 +124,13 @@ static int boot_entry_load(
continue;
}
+ if (isempty(p)) {
+ /* Some fields can reasonably have an empty value. In other cases warn. */
+ if (!STR_IN_SET(field, "options", "devicetree-overlay"))
+ log_warning("%s:%u: Field %s without value", tmp.path, line, field);
+ continue;
+ }
+
if (streq(field, "title"))
r = free_and_strdup(&tmp.title, p);
else if (streq(field, "version"))
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化