File libyang-CVE-2021-28904.patch of Package libyang.25793

From 59a0bff1a5a2f0a0eac07e4bf94d4aea9dd3708d Mon Sep 17 00:00:00 2001
From: Michal Vasko <mvasko@cesnet.cz>
Date: Mon, 8 Mar 2021 09:20:30 +0100
Subject: [PATCH] plugins BUGFIX handle empty revision correctly

Fixes #1451
---
 src/plugins.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/plugins.c b/src/plugins.c
index 7e6fdf358..fa62ce76c 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -457,9 +457,8 @@ ext_get_plugin(const char *name, const char *module, const char *revision)
     assert(module);
 
     for (u = 0; u < ext_plugins_count; u++) {
-        if (!strcmp(name, ext_plugins[u].name) &&
-                !strcmp(module, ext_plugins[u].module) &&
-                (!ext_plugins[u].revision || !strcmp(revision, ext_plugins[u].revision))) {
+        if (!strcmp(name, ext_plugins[u].name) && !strcmp(module, ext_plugins[u].module) &&
+                ((!revision && !ext_plugins[u].revision) || (revision && !strcmp(revision, ext_plugins[u].revision)))) {
             /* we have the match */
             return ext_plugins[u].plugin;
         }
openSUSE Build Service is sponsored by