diff --git a/SOURCES/0001-IceListenForWellKnownConnections-Fix-memleak.patch b/SOURCES/0001-IceListenForWellKnownConnections-Fix-memleak.patch new file mode 100644 index 0000000..0357101 --- /dev/null +++ b/SOURCES/0001-IceListenForWellKnownConnections-Fix-memleak.patch @@ -0,0 +1,28 @@ +From 6fed0334c99d3c088752b462d106a84266fb1114 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 10 Apr 2019 11:01:31 +0200 +Subject: [PATCH libICE 1/3] IceListenForWellKnownConnections: Fix memleak + +The function `_IceTransMakeAllCOTSServerListeners` allocates memory for +`transConns` which is leaked in case of error. + +Signed-off-by: Olivier Fourdan +--- + src/listenwk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/listenwk.c b/src/listenwk.c +index 7517ea8..9ff26da 100644 +--- a/src/listenwk.c ++++ b/src/listenwk.c +@@ -61,6 +61,7 @@ IceListenForWellKnownConnections ( + strncpy (errorStringRet, + "Cannot establish any listening sockets", errorLength); + ++ free (transConns); + return (0); + } + +-- +2.21.0 + diff --git a/SOURCES/0002-_IceRead-Avoid-possible-use-after-free.patch b/SOURCES/0002-_IceRead-Avoid-possible-use-after-free.patch new file mode 100644 index 0000000..f050345 --- /dev/null +++ b/SOURCES/0002-_IceRead-Avoid-possible-use-after-free.patch @@ -0,0 +1,31 @@ +From 32a9acc48463931e598188e3277c88925a48d7b5 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 10 Apr 2019 11:15:11 +0200 +Subject: [PATCH libICE 2/3] _IceRead: Avoid possible use-after-free + +`_IceRead()` gets called from multiple places which do not expect the +connection to be freed. + +Do not free the connection data in `_IceRead()` to avoid potential +use-after-free issue in the various callers. + +Signed-off-by: Olivier Fourdan +--- + src/misc.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/misc.c b/src/misc.c +index d2e9150..54b179d 100644 +--- a/src/misc.c ++++ b/src/misc.c +@@ -242,7 +242,6 @@ _IceRead ( + */ + + _IceConnectionClosed (iceConn); /* invoke watch procs */ +- _IceFreeConnection (iceConn); + + return (0); + } +-- +2.21.0 + diff --git a/SOURCES/0003-cleanup-Separate-variable-assignment-and-test.patch b/SOURCES/0003-cleanup-Separate-variable-assignment-and-test.patch new file mode 100644 index 0000000..bcf004b --- /dev/null +++ b/SOURCES/0003-cleanup-Separate-variable-assignment-and-test.patch @@ -0,0 +1,42 @@ +From c4fcd360d060d50673a4a35ed39c4fe7e4bc3561 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Thu, 11 Apr 2019 09:05:15 +0200 +Subject: [PATCH libICE 3/3] cleanup: Separate variable assignment and test + +Assigning and testing a value in a single statement hinders code clarity +and may confuses static code analyzers. + +Separate the assignment and the test for clarity. + +Signed-off-by: Olivier Fourdan +--- + src/process.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/process.c b/src/process.c +index f0c3369..e3e0a35 100644 +--- a/src/process.c ++++ b/src/process.c +@@ -919,7 +919,8 @@ ProcessConnectionSetup ( + EXTRACT_STRING (pData, swap, vendor); + EXTRACT_STRING (pData, swap, release); + +- if ((hisAuthCount = message->authCount) > 0) ++ hisAuthCount = message->authCount; ++ if (hisAuthCount > 0) + { + hisAuthNames = malloc (hisAuthCount * sizeof (char *)); + EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames); +@@ -1965,7 +1966,8 @@ ProcessProtocolSetup ( + EXTRACT_STRING (pData, swap, vendor); + EXTRACT_STRING (pData, swap, release); + +- if ((hisAuthCount = message->authCount) > 0) ++ hisAuthCount = message->authCount; ++ if (hisAuthCount > 0) + { + hisAuthNames = malloc (hisAuthCount * sizeof (char *)); + EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames); +-- +2.21.0 + diff --git a/SPECS/libICE.spec b/SPECS/libICE.spec index 79632a5..eb78424 100644 --- a/SPECS/libICE.spec +++ b/SPECS/libICE.spec @@ -1,7 +1,7 @@ Summary: X.Org X11 ICE runtime library Name: libICE Version: 1.0.9 -Release: 13%{?dist} +Release: 15%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.x.org @@ -10,6 +10,9 @@ Source0: https://www.x.org/pub/individual/lib/%{name}-%{version}.tar.bz2 Patch0: 0001-Use-getentropy-if-arc4random_buf-is-not-available.patch Patch1: 0002-Add-getentropy-emulation-through-syscall.patch +Patch2: 0001-IceListenForWellKnownConnections-Fix-memleak.patch +Patch3: 0002-_IceRead-Avoid-possible-use-after-free.patch +Patch4: 0003-cleanup-Separate-variable-assignment-and-test.patch BuildRequires: xorg-x11-util-macros BuildRequires: autoconf automake libtool @@ -33,6 +36,9 @@ The X.Org X11 ICE (Inter-Client Exchange) development package. %patch0 -p1 -b .cve-2017-2626 %patch1 -p1 -b .cve-2017-2626 +%patch2 -p1 -b .IceListenForWellKnownConnections-memleak +%patch3 -p1 -b .IceRead-use-after-free +%patch4 -p1 -b .var-assignment-and-test %build autoreconf -v --install --force @@ -72,6 +78,12 @@ done %{_libdir}/pkgconfig/ice.pc %changelog +* Tue Jun 4 2019 Olivier Fourdan - 1.0.9-15 +- Bump version for gating + +* Thu Apr 11 2019 Olivier Fourdan - 1.0.9-14 +- covscan issues (rhbz#1602581) + * Fri Jun 29 2018 Adam Jackson - 1.0.9-13 - Use ldconfig scriptlet macros