aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/libyang/libyang/CVE-2023-26916.patch
blob: f3af3dbffd36a7dfe3991f58b4135c1115d90c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From dc668d296f9f05aeab6315d44cff3208641e3096 Mon Sep 17 00:00:00 2001
From: Michal Vasko <mvasko@cesnet.cz>
Date: Mon, 13 Feb 2023 10:23:13 +0100
Subject: [PATCH] schema compile UPDATE do not implement 2 same modules

CVE: CVE-2023-26916
Upstream-Status: Backport [https://github.com/CESNET/libyang/commit/dc668d296f9f05aeab6315d44cff3208641e3096]

Refs #1979
---
 src/schema_compile.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/schema_compile.c b/src/schema_compile.c
index ed768ba0..68c0d681 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -1748,7 +1748,7 @@ lys_has_compiled_import_r(struct lys_module *mod)
 LY_ERR
 lys_implement(struct lys_module *mod, const char **features, struct lys_glob_unres *unres)
 {
-    LY_ERR ret;
+    LY_ERR r;
     struct lys_module *m;
 
     assert(!mod->implemented);
@@ -1757,21 +1757,15 @@ lys_implement(struct lys_module *mod, const char **features, struct lys_glob_unr
     m = ly_ctx_get_module_implemented(mod->ctx, mod->name);
     if (m) {
         assert(m != mod);
-        if (!strcmp(mod->name, "yang") && (strcmp(m->revision, mod->revision) > 0)) {
-            /* special case for newer internal module, continue */
-            LOGVRB("Internal module \"%s@%s\" is already implemented in revision \"%s\", using it instead.",
-                    mod->name, mod->revision ? mod->revision : "<none>", m->revision ? m->revision : "<none>");
-        } else {
-            LOGERR(mod->ctx, LY_EDENIED, "Module \"%s@%s\" is already implemented in revision \"%s\".",
-                    mod->name, mod->revision ? mod->revision : "<none>", m->revision ? m->revision : "<none>");
-            return LY_EDENIED;
-        }
+        LOGERR(mod->ctx, LY_EDENIED, "Module \"%s@%s\" is already implemented in revision \"%s\".",
+                mod->name, mod->revision ? mod->revision : "<none>", m->revision ? m->revision : "<none>");
+        return LY_EDENIED;
     }
 
     /* set features */
-    ret = lys_set_features(mod->parsed, features);
-    if (ret && (ret != LY_EEXIST)) {
-        return ret;
+    r = lys_set_features(mod->parsed, features);
+    if (r && (r != LY_EEXIST)) {
+        return r;
     }
 
     /*
-- 
2.34.1