Details: https://nvd.nist.gov/vuln/detail/CVE-2022-40320

Pick the patch that was marked to resolve the github bug in the NVD advisory.

Signed-off-by: Gyorgy Sarvari <[email protected]>
---
 .../libconfuse/CVE-2022-40320.patch           | 40 +++++++++++++++++++
 .../libconfuse/libconfuse_3.3.bb              |  4 +-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 
meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch

diff --git 
a/meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch 
b/meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch
new file mode 100644
index 0000000000..ac8dedf012
--- /dev/null
+++ b/meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch
@@ -0,0 +1,40 @@
+From ee3769c0bb797e648dd16997148aad135283e829 Mon Sep 17 00:00:00 2001
+From: Joachim Wiberg <[email protected]>
+Date: Fri, 2 Sep 2022 16:12:46 +0200
+Subject: [PATCH] Fix #163: unterminated username used with getpwnam()
+
+Signed-off-by: Joachim Wiberg <[email protected]>
+
+CVE: CVE-2022-40320
+Upstream-Status: Backport 
[https://github.com/libconfuse/libconfuse/commit/d73777c2c3566fb2647727bb56d9a2295b81669b]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/confuse.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/confuse.c b/src/confuse.c
+index ce4fca8..18dbccf 100644
+--- a/src/confuse.c
++++ b/src/confuse.c
+@@ -1865,16 +1865,19 @@ DLLIMPORT char *cfg_tilde_expand(const char *filename)
+               } else {
+                       /* ~user or ~user/path */
+                       char *user;
++                      size_t len;
+ 
+                       file = strchr(filename, '/');
+                       if (file == 0)
+                               file = filename + strlen(filename);
+ 
+-                      user = malloc(file - filename);
++                      len = file - filename - 1;
++                      user = malloc(len + 1);
+                       if (!user)
+                               return NULL;
+ 
+-                      strncpy(user, filename + 1, file - filename - 1);
++                      strncpy(user, &filename[1], len);
++                      user[len] = 0;
+                       passwd = getpwnam(user);
+                       free(user);
+               }
diff --git a/meta-networking/recipes-support/libconfuse/libconfuse_3.3.bb 
b/meta-networking/recipes-support/libconfuse/libconfuse_3.3.bb
index b8d0536eb3..c98235dda3 100644
--- a/meta-networking/recipes-support/libconfuse/libconfuse_3.3.bb
+++ b/meta-networking/recipes-support/libconfuse/libconfuse_3.3.bb
@@ -3,7 +3,9 @@ LICENSE = "ISC"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=42fa47330d4051cd219f7d99d023de3a"
 
 SRCREV = "a42aebf13db33afd575da6e63f55163d371f776d"
-SRC_URI = 
"git://github.com/libconfuse/libconfuse.git;branch=master;protocol=https"
+SRC_URI = 
"git://github.com/libconfuse/libconfuse.git;branch=master;protocol=https \
+           file://CVE-2022-40320.patch \
+           "
 
 inherit autotools-brokensep pkgconfig gettext
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124685): 
https://lists.openembedded.org/g/openembedded-devel/message/124685
Mute This Topic: https://lists.openembedded.org/mt/118014881/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

  • [oe] [meta-networking][kirkstone... Gyorgy Sarvari via lists.openembedded.org

Reply via email to