Skip to contentSkip to conversation

libyang: fix CVE-2023-26917

PATCH Urade, Yogita 1 participant 1 message Jul 31, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Team,

Gentle Reminder for this patch review!

Regards,
Yogita

Quoted 81 lines · Yogita via lists.openembedded.org

libyang from v2.0.164 to v2.1.30 was discovered to contain a NULL pointer dereference via the function lysp_stmt_validate_value at lys_parse_mem.c.

References:
https://github.com/CESNET/libyang/issues/1987

---
  .../libyang/libyang/CVE-2023-26917.patch      | 40 +++++++++++++++++++
  .../libyang/libyang_2.0.164.bb                |  1 +
  2 files changed, 41 insertions(+)

create mode 100644 meta-oe/recipes-extended/libyang/libyang/CVE-2023-26917.patch

meta-oe/recipes-extended/libyang/libyang/CVE-2023-26917.patch new file +40 -0
new file mode 100644
index 000000000..d7ba2fb9a
@@ -0,0 +1,40 @@
+From cfa1a965a429e4bfc5ae1539a8e87a9cf71c3090 Mon Sep 17 00:00:00 2001
+From: Michal Vasko <[email protected]>
+Date: Tue, 18 Jul 2023 10:41:21 +0000
+Subject: [PATCH] parser common BUGFIX handle missing YANG strings
+
+Fixes #1987
+
+CVE: CVE-2023-26917
+
+Upstream-Status:
+Backport[https://github.com/CESNET/libyang/commit/cfa1a965a429e4bfc5ae1539a8e87a9cf71c3090]
+
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ src/parser_stmt.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/parser_stmt.c b/src/parser_stmt.c
+index 81ccbfca6..2ebf822ab 100644
+--- a/src/parser_stmt.c
++++ b/src/parser_stmt.c
+@@ -52,6 +52,16 @@ lysp_stmt_validate_value(struct lys_parser_ctx *ctx, enum yang_arg val_type, con
+     uint32_t c;
+     size_t utf8_char_len;
+
++    if (!val) {
++	    if (val_type == Y_MAYBE_STR_ARG) {
++		    /* fine */
++		    return LY_SUCCESS;
++	    }
++
++	    LOGVAL_PARSER(ctx, LYVE_SYNTAX, "Missing an expected string.");
++	    return LY_EVALID;
++    }
++
+     while (*val) {
+         LY_CHECK_ERR_RET(ly_getutf8(&val, &c, &utf8_char_len),
+                 LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, (val)[-utf8_char_len]), LY_EVALID);
+--
+2.35.5
meta-oe/recipes-extended/libyang/libyang_2.0.164.bb +1 -1
index 7875c1ef7..eb3f32251 100644
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
             file://libyang-add-stdint-h.patch \
             file://run-ptest \
             file://CVE-2023-26916.patch \
+	    file://CVE-2023-26917.patch \
             "
 
  S = "${WORKDIR}/git"
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#103958): https://lists.openembedded.org/g/openembedded-devel/message/103958
Mute This Topic: https://lists.openembedded.org/mt/100231873/7312273
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-