15 Star 0 Fork 11

src-openEuler/libyang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2021-28902-CVE-2021-28906.patch 2.83 KB
一键复制 编辑 原始数据 按行查看 历史
From a3917d95d516e3de267d3cfa5d4d3715a90e8777 Mon Sep 17 00:00:00 2001
From: Michal Vasko <mvasko@cesnet.cz>
Date: Mon, 8 Mar 2021 14:08:05 +0100
Subject: [PATCH] yin parser BUGFIX invalid memory access
... in case there were some unresolved
extensions.
Fixes #1454
Fixes #1455
---
src/parser_yin.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 275991644..256325415 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -4572,7 +4572,7 @@ read_yin_anydata(struct lys_module *module, struct lys_node *parent, struct lyxm
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -4794,7 +4794,7 @@ read_yin_leaf(struct lys_module *module, struct lys_node *parent, struct lyxml_e
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -5108,7 +5108,7 @@ read_yin_leaflist(struct lys_module *module, struct lys_node *parent, struct lyx
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -5477,7 +5477,7 @@ read_yin_list(struct lys_module *module, struct lys_node *parent, struct lyxml_e
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {
retval->flags |= LYS_VALID_EXT_SUBTREE;
@@ -5701,8 +5701,9 @@ read_yin_container(struct lys_module *module, struct lys_node *parent, struct ly
}
for (r = 0; r < retval->ext_size; ++r) {
- /* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ /* extension instance may not yet be resolved */
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
+ /* set flag, which represent LYEXT_OPT_VALID */
retval->flags |= LYS_VALID_EXT;
if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {
retval->flags |= LYS_VALID_EXT_SUBTREE;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libyang.git
git@gitee.com:src-openeuler/libyang.git
src-openeuler
libyang
libyang
master

搜索帮助