代码拉取完成,页面将自动刷新
From 0fabec8c7fda554b79327d8713352e7a07539895 Mon Sep 17 00:00:00 2001
From: AntonMoryakov <ant.v.moryakov@gmail.com>
Date: Tue, 14 Jan 2025 18:06:49 +0300
Subject: [PATCH] sys-utils: fix add NULL check for mnt_fs_get_target return
value
The static analyzer flagged a potential issue: the return value of
mnt_fs_get_target(fs) could be NULL, but it was dereferenced without
a check. This could lead to undefined behavior.
Added a NULL check before using the tgt pointer. If tgt is NULL,
the current iteration is skipped.
ChanChanges:
- Added if (!tgt) check before using tgt.
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reference:https://github.com/util-linux/util-linux/commit/0fabec8c7fda554b79327d8713352e7a07539895
Conflict:NA
---
sys-utils/lsns.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 500bc013..93bbd758 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -1132,6 +1132,9 @@ static int nsfs_xasputs(char **str,
const char *tgt = mnt_fs_get_target(fs);
+ if(!tgt)
+ continue;
+
if (!*str)
xasprintf(str, "%s", tgt);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。