Skip to contentSkip to conversation

libsolv: Security fix for CVEs: <CVE-2018-20532, CVE-2018-20533, CVE-2018-20534>

PATCH Superseded Muminul Islam 1 participant 1 message Oct 8, 2019

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libsolv: Security fix for CVEs: <CVE-2018-20532, CVE-2018-20533, CVE-2018-20534>

CVE: CVE-2018-20532, CVE-2018-20533, CVE-2018-20534

Upstream-Status: Backport

Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits

---
 ...0003-Fix-Dereference-of-null-pointer.patch |  33 ++++
 .../0004-Fix-Add-va_end-before-return.patch   |  36 ++++
 .../libsolv/0005-Fix-Memory-leaks.patch       | 158 ++++++++++++++++++
 .../libsolv/0006-Fix-testsolv-segfault.patch  |  41 +++++
 .../libsolv/0007-Fix-testsolv-segfaults.patch |  47 ++++++
 ...008-Fix-Be-sure-that-NONBLOCK-is-set.patch |  37 ++++
 ...Don-t-set-values-that-are-never-read.patch | 113 +++++++++++++
 .../libsolv/libsolv_0.6.35.bb                 |   7 +
 8 files changed, 472 insertions(+)
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0003-Fix-Dereference-of-null-pointer.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0004-Fix-Add-va_end-before-return.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0005-Fix-Memory-leaks.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0006-Fix-testsolv-segfault.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0007-Fix-testsolv-segfaults.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0008-Fix-Be-sure-that-NONBLOCK-is-set.patch
 create mode 100644 meta/recipes-extended/libsolv/libsolv/0009-Don-t-set-values-that-are-never-read.patch
meta/recipes-extended/libsolv/libsolv/0003-Fix-Dereference-of-null-pointer.patch new file +33 -0
new file mode 100644
index 0000000000..42930f334b
@@ -0,0 +1,33 @@
+From fcd9e3aba122a220af617a802c4f47bad4b51e64 Mon Sep 17 00:00:00 2001
+From: Jaroslav Rohel <[email protected]>
+Date: Fri, 7 Dec 2018 07:05:10 +0100
+Subject: [PATCH] Fix: Dereference of null pointer
+Reply-To: [email protected]
+CVE: CVE-2018-20532, CVE-2018-20533, CVE-2018-20534
+
+Upstream-Status: Backport
+
+Signed-off-by: Muminul Islam <[email protected]>
+
+Cherry picked from  https://github.com/openSUSE/libsolv/pull/291/commits
+
+---
+ ext/repo_repomdxml.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ext/repo_repomdxml.c b/ext/repo_repomdxml.c
+index 760d481f..b2a5b8dd 100644
+--- a/ext/repo_repomdxml.c
++++ b/ext/repo_repomdxml.c
+@@ -181,7 +181,7 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
+             while (value)
+ 	      {
+ 		char *p = strchr(value, ',');
+-		if (*p)
++		if (p)
+ 		  *p++ = 0;
+ 		if (*value)
+ 		  repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_UPDATES, value);
+-- 
+2.23.0
+
meta/recipes-extended/libsolv/libsolv/0004-Fix-Add-va_end-before-return.patch new file +36 -0
new file mode 100644
index 0000000000..73e104633c
@@ -0,0 +1,36 @@
+From 58053b44c9ed043d48fa7dd595d213849b733f0f Mon Sep 17 00:00:00 2001
+From: Jaroslav Rohel <[email protected]>
+Date: Tue, 11 Dec 2018 09:50:06 +0100
+Subject: [PATCH] Fix: Add va_end() before return
+Reply-To: [email protected]
+
+The va_end() performs cleanup.
+If va_end() is not called before a function that calls va_start() returns,
+the behavior is undefined.
+
+CVE: CVE-2018-20532, CVE-2018-20533, CVE-2018-20534
+
+Upstream-Status: Backport
+
+Signed-off-by: Muminul Islam <[email protected]>
+
+Cherry picked from  https://github.com/openSUSE/libsolv/pull/291/commits
+---
+ src/pool.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/pool.c b/src/pool.c
+index 60cc0f49..f03b43f9 100644
+--- a/src/pool.c
++++ b/src/pool.c
+@@ -1505,6 +1505,7 @@ pool_debug(Pool *pool, int type, const char *format, ...)
+         vprintf(format, args);
+       else
+         vfprintf(stderr, format, args);
++      va_end(args);
+       return;
+     }
+   vsnprintf(buf, sizeof(buf), format, args);
+-- 
+2.23.0
+
meta/recipes-extended/libsolv/libsolv/0005-Fix-Memory-leaks.patch new file +158 -0

158 lines not on this page · raw message

meta/recipes-extended/libsolv/libsolv/0006-Fix-testsolv-segfault.patch new file +41 -0

41 lines not on this page · raw message

meta/recipes-extended/libsolv/libsolv/0007-Fix-testsolv-segfaults.patch new file +47 -0

47 lines not on this page · raw message

meta/recipes-extended/libsolv/libsolv/0008-Fix-Be-sure-that-NONBLOCK-is-set.patch new file +37 -0
new file mode 100644
index 0000000000..9c8f102ad5
@@ -0,0 +1,37 @@
+From ebb51f73491987435664ac14b79bebe16ffbdd5c Mon Sep 17 00:00:00 2001
+From: Jaroslav Rohel <[email protected]>
+Date: Tue, 11 Dec 2018 12:40:42 +0100
+Subject: [PATCH] Fix: Be sure that NONBLOCK is set
+Reply-To: [email protected]
+
+CVE: CVE-2018-20532, CVE-2018-20533, CVE-2018-20534
+
+Upstream-Status: Backport
+
+Signed-off-by: Muminul Islam <[email protected]>
+
+Cherry picked from  https://github.com/openSUSE/libsolv/pull/291/commits
+---
+ examples/solv/fastestmirror.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/examples/solv/fastestmirror.c b/examples/solv/fastestmirror.c
+index d2ebd97a..0ee4e73b 100644
+--- a/examples/solv/fastestmirror.c
++++ b/examples/solv/fastestmirror.c
+@@ -68,7 +68,11 @@ findfastest(char **urls, int nurls)
+ 	  socks[i] = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
+ 	  if (socks[i] >= 0)
+ 	    {
+-	      fcntl(socks[i], F_SETFL, O_NONBLOCK);
++	      if (fcntl(socks[i], F_SETFL, O_NONBLOCK) == -1)
++            {
++		      close(socks[i]);
++		      socks[i] = -1;
++            }
+ 	      if (connect(socks[i], result->ai_addr, result->ai_addrlen) == -1)
+ 		{
+ 		  if (errno != EINPROGRESS)
+-- 
+2.23.0
+
meta/recipes-extended/libsolv/libsolv/0009-Don-t-set-values-that-are-never-read.patch new file +113 -0

113 lines not on this page · raw message

meta/recipes-extended/libsolv/libsolv_0.6.35.bb +7 -0
index 12dfc5d3a2..ed6a7cbfd5 100644
@@ -10,6 +10,13 @@ DEPENDS = "expat zlib"
 SRC_URI = "git://github.com/openSUSE/libsolv.git"
 SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch \
                              file://0002-Fixes-to-internal-fopencookie-implementation.patch \
+                             file://0003-Fix-Dereference-of-null-pointer.patch \
+                             file://0004-Fix-Add-va_end-before-return.patch \
+                             file://0005-Fix-Memory-leaks.patch \
+                             file://0006-Fix-testsolv-segfault.patch \
+                             file://0007-Fix-testsolv-segfaults.patch \
+                             file://0008-Fix-Be-sure-that-NONBLOCK-is-set.patch \
+                             file://0009-Don-t-set-values-that-are-never-read.patch \
                            "
 
 SRCREV = "38c5374d4712667b0b6ada4bf78ddbb343095d0c"
Signature · 1 line
2.23.0