代码拉取完成,页面将自动刷新
From 158fb95ef28af13ccc8a6f1474aaa2e69620afd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Wed, 15 Jan 2025 14:13:25 +0100
Subject: [PATCH] checkpolicy: check identifier before copying
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Avoid calling strdup(3) with a NULL pointer, which can happen with an
invalid policy context, e.g.:
class C
sid S
class C { P }
;
user U roles j;
sid S s:l:q:q:q
Fixes: 6f2b689f ("checkpolicy: Fix MLS users in optional blocks")
Reported-by: oss-fuzz (issue 390004173)
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
policy_define.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/policy_define.c b/policy_define.c
index 2f811b67..96a481f7 100644
--- a/policy_define.c
+++ b/policy_define.c
@@ -4411,6 +4411,7 @@ static int parse_semantic_categories(char *id, level_datum_t * levdatum __attrib
int define_user(void)
{
+ const char *username;
char *id;
user_datum_t *usrdatum, *usr_global;
level_datum_t *levdatum;
@@ -4437,7 +4438,13 @@ int define_user(void)
return 0;
}
- id = strdup(queue_head(id_queue));
+ username = queue_head(id_queue);
+ if (!username) {
+ yyerror("no user name");
+ return -1;
+ }
+
+ id = strdup(username);
if ((usrdatum = declare_user()) == NULL) {
free(id);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。