Skip to contentSkip to conversation

Revert "c-ares: Add fix for CVE-2021-3672"

PATCH New Akash Hadke 1 participant 5 messages Aug 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 Revert "c-ares: Add fix for CVE-2021-3672"

From: Ranjitsinh Rathod <[email protected]>

This reverts commit b06724bc274f751004ade2ceeddfb8ec40d93f16. Revert this CVE fix as we upgrade c-ares to 1.18.1

---
 ...-fix-formatting-and-handling-of-root.patch | 115 ------------------
 ...d_name-should-escape-more-characters.patch |  90 --------------
 .../recipes-support/c-ares/c-ares_1.16.1.bb   |   2 -
 3 files changed, 207 deletions(-)
 delete mode 100644 meta-oe/recipes-support/c-ares/c-ares/ares_expand_name-fix-formatting-and-handling-of-root.patch
 delete mode 100644 meta-oe/recipes-support/c-ares/c-ares/ares_expand_name-should-escape-more-characters.patch
meta-oe/recipes-support/c-ares/c-ares/ares_expand_name-fix-formatting-and-handling-of-root.patch deleted +0 -115
deleted file mode 100644
index d1cb54aefb..0000000000
@@ -1,115 +0,0 @@
-From: bradh352 <[email protected]>
-Date: Fri, 11 Jun 2021 12:39:24 -0400
-Subject: [2/2] ares_expand_name(): fix formatting and handling of root name
- response
-Origin: https://github.com/c-ares/c-ares/commit/44c009b8e62ea1929de68e3f438181bea469ec14
-Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-3672
-
-Fixes issue introduced in prior commit with formatting and handling
-of parsing a root name response which should not be escaped.
-
-Fix By: Brad House
-CVE: CVE-2021-3672
-Upstream-Status: Backport [http://snapshot.debian.org/archive/debian-security/20210810T064453Z/pool/updates/main/c/c-ares/c-ares_1.17.1-1%2Bdeb11u1.debian.tar.xz]
-Signed-off-by: Neetika Singh <[email protected]>
----
- ares_expand_name.c | 62 ++++++++++++++++++++++++--------------
- 1 file changed, 40 insertions(+), 22 deletions(-)
-
-diff --git a/ares_expand_name.c b/ares_expand_name.c
-index f1c874a97cfc..eb9268c1ff0a 100644
---- a/ares_expand_name.c
-+++ b/ares_expand_name.c
-@@ -127,27 +127,37 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
-         }
-       else
-         {
--          len = *p;
-+          int name_len = *p;
-+          len = name_len;
-           p++;
-+
-           while (len--)
-             {
--              if (!isprint(*p)) {
--                /* Output as \DDD for consistency with RFC1035 5.1 */
--                *q++ = '\\';
--                *q++ = '0' + *p / 100;
--                *q++ = '0' + (*p % 100) / 10;
--                *q++ = '0' + (*p % 10);
--              } else if (is_reservedch(*p)) {
--                *q++ = '\\';
--                *q++ = *p;
--              } else {
--                *q++ = *p;
--              }
-+              /* Output as \DDD for consistency with RFC1035 5.1, except
-+               * for the special case of a root name response  */
-+              if (!isprint(*p) && !(name_len == 1 && *p == 0))
-+                {
-+
-+                  *q++ = '\\';
-+                  *q++ = '0' + *p / 100;
-+                  *q++ = '0' + (*p % 100) / 10;
-+                  *q++ = '0' + (*p % 10);
-+                }
-+              else if (is_reservedch(*p))
-+                {
-+                  *q++ = '\\';
-+                  *q++ = *p;
-+                }
-+              else
-+                {
-+                  *q++ = *p;
-+                }
-               p++;
-             }
-           *q++ = '.';
-         }
--    }
-+     }
-+
-   if (!indir)
-     *enclen = aresx_uztosl(p + 1U - encoded);
- 
-@@ -194,21 +204,29 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
-         }
-       else if (top == 0x00)
-         {
--          offset = *encoded;
-+          int name_len = *encoded;
-+          offset = name_len;
-           if (encoded + offset + 1 >= abuf + alen)
-             return -1;
-           encoded++;
-+
-           while (offset--)
-             {
--              if (!isprint(*encoded)) {
--                n += 4;
--              } else if (is_reservedch(*encoded)) {
--                n += 2;
--              } else {
--                n += 1;
--              }
-+              if (!isprint(*encoded) && !(name_len == 1 && *encoded == 0))
-+                {
-+                  n += 4;
-+                }
-+              else if (is_reservedch(*encoded))
-+                {
-+                  n += 2;
-+                }
-+              else
-+                {
-+                  n += 1;
-+                }
-               encoded++;
-             }
-+
-           n++;
-         }
-       else
--- 
-2.32.0
-
meta-oe/recipes-support/c-ares/c-ares/ares_expand_name-should-escape-more-characters.patch deleted +0 -90

90 lines not on this page · raw message

meta-oe/recipes-support/c-ares/c-ares_1.16.1.bb +0 -2
index 692a5f0d6e..0e118c88ff 100644
@@ -11,8 +11,6 @@ SRC_URI = "\
     git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
     file://cmake-install-libcares.pc.patch \
     file://0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch \
-    file://ares_expand_name-should-escape-more-characters.patch \
-    file://ares_expand_name-fix-formatting-and-handling-of-root.patch \
 "
 SRCREV = "74a1426ba60e2cd7977e53a22ef839c87415066e"
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/5 c-ares: Upgrade to 1.17.1 release

From: Khem Raj <[email protected]>

Forward port cmake-install-libcares.pc.patch, drop the need to install pkgconfig files as its already being done by main Makefile

Conflicts:
meta-oe/recipes-support/c-ares/c-ares_1.17.1.bb

(cherry picked from commit b65f2904191b8d309b3971d4e65c5e1701156b1c)
---
 .../c-ares/cmake-install-libcares.pc.patch    | 27 +++++++------------
 .../{c-ares_1.16.1.bb => c-ares_1.17.1.bb}    |  4 +--
 2 files changed, 12 insertions(+), 19 deletions(-)
 rename meta-oe/recipes-support/c-ares/{c-ares_1.16.1.bb => c-ares_1.17.1.bb} (89%)
meta-oe/recipes-support/c-ares/c-ares/cmake-install-libcares.pc.patch +10 -17
index 0eb7e4bbb3..c6f9c6de61 100644
@@ -1,4 +1,4 @@
-From 12414304245cce6ef0e8b9547949be5109845353 Mon Sep 17 00:00:00 2001
+From 2cc41bee63223cb398ea932aad6ecc94ff5b61dd Mon Sep 17 00:00:00 2001
 From: Changqing Li <[email protected]>
 Date: Tue, 24 Jul 2018 13:33:33 +0800
 Subject: [PATCH] cmake: Install libcares.pc
@@ -11,12 +11,13 @@ Signed-off-by: Alexey Firago <[email protected]>
 update to 1.14.0, fix patch warning
 
 Signed-off-by: Changqing Li <[email protected]>
+
 ---
- CMakeLists.txt | 28 +++++++++++++++++++++++-----
- 1 file changed, 23 insertions(+), 5 deletions(-)
+ CMakeLists.txt | 23 +++++++++++++++++------
+ 1 file changed, 17 insertions(+), 6 deletions(-)
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index fd123e1..3a5878d 100644
+index 08c0247..0020d6b 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -214,22 +214,25 @@ ADD_DEFINITIONS(${SYSFLAGS})
@@ -50,9 +51,9 @@ index fd123e1..3a5878d 100644
  
  # When checking for symbols, we need to make sure we set the proper
  # headers, libraries, and definitions for the detection to work properly
-@@ -554,6 +557,15 @@ CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
- # Write ares_config.h configuration file.  This is used only for the build.
- CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h)
+@@ -551,6 +554,15 @@ ENDIF()
+ # Record toplevel CMakeLists.txt path
+ set(CARES_TOPLEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
  
 +# Pass required CFLAGS to pkg-config in case of static library
 +IF (CARES_STATIC)
@@ -66,19 +67,11 @@ index fd123e1..3a5878d 100644
  
  # TRANSFORM_MAKEFILE_INC
  #
-@@ -728,6 +740,12 @@ IF (CARES_INSTALL)
+@@ -624,7 +636,6 @@ IF (CARES_INSTALL)
  	INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" COMPONENT Devel DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
  ENDIF ()
  
-+# pkg-config file
-+IF (CARES_INSTALL)
-+       SET (PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
-+       INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" DESTINATION ${PKGCONFIG_INSTALL_DIR})
-+ENDIF ()
-+
+-
  # Legacy chain-building variables (provided for compatibility with old code).
  # Don't use these, external code should be updated to refer to the aliases directly (e.g., Cares::cares).
  SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
--- 
-2.17.1
-
meta-oe/recipes-support/c-ares/c-ares_1.17.1.bb renamed from meta-oe/recipes-support/c-ares/c-ares_1.16.1.bb +2 -2
similarity index 89%
rename from meta-oe/recipes-support/c-ares/c-ares_1.16.1.bb
rename to meta-oe/recipes-support/c-ares/c-ares_1.17.1.bb
index 0e118c88ff..de27d736ad 100644
@@ -5,14 +5,14 @@ SECTION = "libs"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
 
-PV = "1.16.1+gitr${SRCPV}"
+PV = "1.17.1"
 
 SRC_URI = "\
     git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
     file://cmake-install-libcares.pc.patch \
     file://0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch \
 "
-SRCREV = "74a1426ba60e2cd7977e53a22ef839c87415066e"
+SRCREV = "39c73b503d9ef70a58ad1f4a4643f15b01407c66"
 
 UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/5 c-ares: upgrade 1.17.1 -> 1.17.2

In reply to Akash Hadke

From: wangmy <[email protected]>

Conflicts:
meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb

(cherry picked from commit c49173b09c998bb3893ae873f68823647f1a7e18)
---
 .../c-ares/{c-ares_1.17.1.bb => c-ares_1.17.2.bb}   | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
 rename meta-oe/recipes-support/c-ares/{c-ares_1.17.1.bb => c-ares_1.17.2.bb} (63%)
meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb renamed from meta-oe/recipes-support/c-ares/c-ares_1.17.1.bb +5 -8
similarity index 63%
rename from meta-oe/recipes-support/c-ares/c-ares_1.17.1.bb
rename to meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb
index de27d736ad..19e35db2d7 100644
@@ -5,14 +5,11 @@ SECTION = "libs"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
 
-PV = "1.17.1"
-
-SRC_URI = "\
-    git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
-    file://cmake-install-libcares.pc.patch \
-    file://0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch \
-"
-SRCREV = "39c73b503d9ef70a58ad1f4a4643f15b01407c66"
+SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
+           file://cmake-install-libcares.pc.patch \
+           file://0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch \
+           "
+SRCREV = "6654436a307a5a686b008c1d4c93b0085da6e6d8"
 
 UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/5 c-ares: remove custom patches

In reply to Akash Hadke

From: Sinan Kaya <[email protected]>

Current patch is breaking the library dependencies added by cmake especially when you are static linking.

Applications need the ws2_32 library to be linked for mingw32 and with the existing patch this is not getting passed to the users.

Current patch seems to address this issue:
https://github.com/c-ares/c-ares/issues/373

Both issues are resolved in 1.17.2:

1.17.2-r0/git $ find . | grep c-ares-config.cmake.in ./c-ares-config.cmake.in
1.17.2-r0/git $ find . | grep libcares.pc.cmake ./libcares.pc.cmake

Conflicts:
meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb

(cherry picked from commit 621bdc1993d2e8da08b9b240043dc13481cd644f)
---
 ...ror-mv-libcares.pc.cmakein-to-libcar.patch | 27 -------
 .../c-ares/cmake-install-libcares.pc.patch    | 77 -------------------
 .../recipes-support/c-ares/c-ares_1.17.2.bb   |  5 +-
 3 files changed, 1 insertion(+), 108 deletions(-)
 delete mode 100644 meta-oe/recipes-support/c-ares/c-ares/0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch
 delete mode 100644 meta-oe/recipes-support/c-ares/c-ares/cmake-install-libcares.pc.patch
meta-oe/recipes-support/c-ares/c-ares/0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch deleted +0 -27
deleted file mode 100644
index 8f15f8424c..0000000000
@@ -1,27 +0,0 @@
-From f2f1e134bf5d9d0789942848e03006af8d926cf8 Mon Sep 17 00:00:00 2001
-From: Wang Mingyu <[email protected]>
-Date: Tue, 17 Mar 2020 12:53:35 +0800
-Subject: [PATCH] fix configure error : mv libcares.pc.cmakein to
- libcares.pc.cmake
-
-Signed-off-by: Wang Mingyu <[email protected]>
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 3a5878d..c2e5740 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -563,7 +563,7 @@ IF (CARES_STATIC)
- ENDIF()
- 
- # Write ares_config.h configuration file.  This is used only for the build.
--CONFIGURE_FILE (libcares.pc.cmakein ${PROJECT_BINARY_DIR}/libcares.pc @ONLY)
-+CONFIGURE_FILE (libcares.pc.cmake ${PROJECT_BINARY_DIR}/libcares.pc @ONLY)
- 
- 
- 
--- 
-2.17.1
-
meta-oe/recipes-support/c-ares/c-ares/cmake-install-libcares.pc.patch deleted +0 -77

77 lines not on this page · raw message

meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb +1 -4
index 19e35db2d7..80d711a36f 100644
@@ -5,10 +5,7 @@ SECTION = "libs"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
 
-SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
-           file://cmake-install-libcares.pc.patch \
-           file://0001-fix-configure-error-mv-libcares.pc.cmakein-to-libcar.patch \
-           "
+SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https"
 SRCREV = "6654436a307a5a686b008c1d4c93b0085da6e6d8"
 
 UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
Signature · 1 line
2.17.1
#4 lore raw

PATCH 5/5 c-ares: upgrade 1.17.2 -> 1.18.1

In reply to Akash Hadke

From: wangmy <[email protected]>

c-ares version 1.18.1 - Oct 27 2021
Bug fixes:

ares_getaddrinfo() would return ai_addrlen of 16 for ipv6 adddresses rather than the sizeof(struct sockaddr_in6)

Conflicts:
meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb

(cherry picked from commit e251d7b827d63277a36f1b8094d992303329b866)
---
 .../c-ares/{c-ares_1.17.2.bb => c-ares_1.18.1.bb}               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-oe/recipes-support/c-ares/{c-ares_1.17.2.bb => c-ares_1.18.1.bb} (91%)
meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb renamed from meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb +1 -1
similarity index 91%
rename from meta-oe/recipes-support/c-ares/c-ares_1.17.2.bb
rename to meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb
index 80d711a36f..6e0d0fc38f 100644
@@ -6,7 +6,7 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
 
 SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https"
-SRCREV = "6654436a307a5a686b008c1d4c93b0085da6e6d8"
+SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
 
 UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
 
Signature · 1 line
2.17.1