Skip to content

Commit 32bbd28

Browse files
RafaelGSSdenihs
authored andcommitted
deps: update c-ares to 1.19.1
PR-URL: nodejs#48115 Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/437 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Rich Trott <[email protected]> # Conflicts: # deps/cares/CHANGES # deps/cares/CMakeLists.txt # deps/cares/RELEASE-NOTES # deps/cares/aminclude_static.am # deps/cares/configure # deps/cares/configure.ac # deps/cares/include/ares_version.h # deps/cares/src/lib/Makefile.in # deps/cares/src/lib/ares_data.h # deps/cares/src/lib/ares_destroy.c # deps/cares/src/lib/ares_getaddrinfo.c # deps/cares/src/lib/ares_init.c # deps/cares/src/lib/ares_strsplit.c
1 parent 2adbba5 commit 32bbd28

37 files changed

+3764
-1797
lines changed

deps/cares/CHANGES

Lines changed: 670 additions & 237 deletions
Large diffs are not rendered by default.

deps/cares/CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ INCLUDE (CheckCSourceCompiles)
88
INCLUDE (CheckStructHasMember)
99
INCLUDE (CheckLibraryExists)
1010

11-
PROJECT (c-ares LANGUAGES C VERSION "1.18.0" )
11+
PROJECT (c-ares LANGUAGES C VERSION "1.19.1" )
1212

1313
# Set this version before release
14-
SET (CARES_VERSION "1.18.1")
14+
SET (CARES_VERSION "1.19.1")
1515

1616
INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong.
1717

@@ -26,7 +26,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
2626
# For example, a version of 4:0:2 would generate output such as:
2727
# libname.so -> libname.so.2
2828
# libname.so.2 -> libname.so.2.2.0
29-
SET (CARES_LIB_VERSIONINFO "7:1:5")
29+
SET (CARES_LIB_VERSIONINFO "8:1:6")
3030

3131

3232
OPTION (CARES_STATIC "Build as a static library" OFF)
@@ -36,6 +36,8 @@ OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)
3636
OPTION (CARES_BUILD_TESTS "Build and run tests" OFF)
3737
OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARES_BUILD_TESTS, Linux only)" OFF)
3838
OPTION (CARES_BUILD_TOOLS "Build tools" ON)
39+
SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom")
40+
3941

4042
# Tests require static to be enabled on Windows to be able to access otherwise hidden symbols
4143
IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32)
@@ -82,9 +84,14 @@ SET (TARGETS_INST_DEST
8284

8385
# Function in Library
8486
# CHECK_LIBRARY_EXISTS can't be used as it will return true if the function
85-
# is found in a different dependent library.
87+
# is found in a different required/dependent library.
8688
MACRO (CARES_FUNCTION_IN_LIBRARY func lib var)
89+
90+
SET (_ORIG_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
91+
SET (CMAKE_REQUIRED_LIBRARIES )
8792
CHECK_FUNCTION_EXISTS ("${func}" "_CARES_FUNC_IN_LIB_GLOBAL_${func}")
93+
SET (CMAKE_REQUIRED_LIBRARIES "${_ORIG_CMAKE_REQUIRED_LIBRARIES}")
94+
8895
IF ("${_CARES_FUNC_IN_LIB_GLOBAL_${func}}")
8996
SET (${var} FALSE)
9097
ELSE ()
@@ -386,6 +393,8 @@ CHECK_SYMBOL_EXISTS (strncasecmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCAS
386393
CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMPI)
387394
CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP)
388395
CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV)
396+
CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF)
397+
389398

390399
# On Android, the system headers may define __system_property_get(), but excluded
391400
# from libc. We need to perform a link test instead of a header/symbol test.
@@ -397,10 +406,6 @@ SET (CMAKE_REQUIRED_DEFINITIONS)
397406
SET (CMAKE_REQUIRED_LIBRARIES)
398407

399408

400-
find_file(CARES_RANDOM_FILE urandom /dev)
401-
mark_as_advanced(CARES_RANDOM_FILE)
402-
403-
404409
################################################################################
405410
# recv, recvfrom, send, getnameinfo, gethostname
406411
# ARGUMENTS AND RETURN VALUES
@@ -689,6 +694,12 @@ IF (CARES_INSTALL)
689694
if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
690695

691696
if ( "${CPACK_PACKAGE_ARCHITECTURE}" STREQUAL "" )
697+
set( CPACK_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}" )
698+
endif()
699+
if ( "${CPACK_PACKAGE_ARCHITECTURE}" STREQUAL "" )
700+
if ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" )
701+
message( FATAL_ERROR "Failed to determine CPACK_PACKAGE_ARCHITECTURE. Is CMAKE_SYSTEM_PROCESSOR set?" )
702+
endif()
692703
# Note: the architecture should default to the local architecture, but it
693704
# in fact comes up empty. We call `uname -m` to ask the kernel instead.
694705
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE )

deps/cares/Makefile.Watcom

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#
22
# Watcom / OpenWatcom / Win32 makefile for cares.
33
# Quick hack by Guenter; comments to: /dev/nul
4+
# Updated by Douglas R. Reno, comments to: [email protected]. 2023
45
#
56

67
!ifndef %watcom
@@ -38,9 +39,9 @@ MD = mkdir
3839
RD = rmdir /q /s 2>NUL
3940
CP = copy
4041

41-
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
42-
-wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
43-
-dNTDDI_VERSION=0x05010000 -I. $(SYS_INCL)
42+
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa &
43+
-wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
44+
-dNTDDI_VERSION=0x06000000 -I. -I.\include -I.\src\lib $(SYS_INCL)
4445

4546
LFLAGS = option quiet, map, caseexact, eliminate
4647

@@ -69,7 +70,7 @@ LIB_ARG = $(OBJ_BASE)\stat\wlib.arg
6970
!ifneq __MAKEOPTS__ -u
7071
!error You MUST call wmake with the -u switch!
7172
!else
72-
!include Makefile.inc
73+
!include src\lib\Makefile.inc
7374
!endif
7475

7576
OBJS = $(CSOURCES:.c=.obj)
@@ -82,10 +83,11 @@ OBJ_DIR = $(OBJ_BASE)\stat
8283
OBJS_STAT = $+ $(OBJS) $-
8384

8485
OBJ_DIR = $(OBJ_BASE)\dyn
85-
OBJS_DYN = $+ $(OBJS) $-
86+
OBJS_DYN += $(OBJS) $-
8687

8788
ARESBUILDH = ares_build.h
8889
RESOURCE = $(OBJ_BASE)\dyn\cares.res
90+
ARESBUILDH = include\ares_build.h
8991

9092
all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
9193
@echo Welcome to cares
@@ -94,25 +96,31 @@ $(OBJ_BASE):
9496
-$(MD) $^@
9597
-$(MD) $^@\stat
9698
-$(MD) $^@\dyn
97-
-$(MD) $^@\demos
99+
-$(MD) $^@\tools
98100

99101
$(ARESBUILDH): .EXISTSONLY
100-
$(CP) $^@.dist $^@
102+
@echo Make sure to run buildconf.bat!
101103

102104
$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG)
103105
$(LD) name $^@ @$]@
104106

105107
$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
106108
$(AR) -q -b -c $^@ @$]@
107109

108-
adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
109-
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
110+
$(OBJ_BASE)\tools\ares_getopt.obj:
111+
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\tools\ares_getopt.c -fo=$^@
110112

111-
ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
112-
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
113+
adig.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
114+
$(CC) $(CFLAGS) src\tools\adig.c -fo=$(OBJ_BASE)\tools\adig.obj
115+
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\adig.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
113116

114-
acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
115-
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
117+
ahost.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
118+
$(CC) $(CFLAGS) src\tools\ahost.c -fo=$(OBJ_BASE)\tools\ahost.obj
119+
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\ahost.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
120+
121+
acountry.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
122+
$(CC) $(CFLAGS) src\tools\acountry.c -fo=$(OBJ_BASE)\tools\acountry.obj
123+
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\acountry.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
116124

117125
clean: .SYMBOLIC
118126
-$(RM) $(OBJS_STAT)
@@ -124,24 +132,23 @@ vclean realclean: clean .SYMBOLIC
124132
-$(RM) $(DEMOS) $(DEMOS:.exe=.map)
125133
-$(RD) $(OBJ_BASE)\stat
126134
-$(RD) $(OBJ_BASE)\dyn
127-
-$(RD) $(OBJ_BASE)\demos
135+
-$(RD) $(OBJ_BASE)\tools
128136
-$(RD) $(OBJ_BASE)
129137

130138
.ERASE
131-
$(RESOURCE): cares.rc .AUTODEPEND
139+
.c: .\src\lib
140+
141+
.ERASE
142+
$(RESOURCE): src\lib\cares.rc .AUTODEPEND
132143
$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
133144

134145
.ERASE
135146
.c{$(OBJ_BASE)\dyn}.obj:
136-
$(CC) $(CFLAGS) -bd $[@ -fo=$^@
147+
$(CC) $(CFLAGS) -bd .\src\lib\$^& -fo=$^@
137148

138149
.ERASE
139150
.c{$(OBJ_BASE)\stat}.obj:
140-
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
141-
142-
.ERASE
143-
.c{$(OBJ_BASE)\demos}.obj:
144-
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
151+
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\$^& -fo=$^@
145152

146153
$(LINK_ARG): $(__MAKEFILES__)
147154
%create $^@
@@ -155,6 +162,7 @@ $(LINK_ARG): $(__MAKEFILES__)
155162
@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
156163
!else
157164
@%append $^@ library ws2_32.lib
165+
@%append $^@ library iphlpapi.lib
158166
!endif
159167

160168
$(LIB_ARG): $(__MAKEFILES__)

deps/cares/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
9696
$(top_srcdir)/m4/ax_am_macros_static.m4 \
9797
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
9898
$(top_srcdir)/m4/ax_code_coverage.m4 \
99+
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
99100
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
100101
$(top_srcdir)/m4/ax_file_escapes.m4 \
101102
$(top_srcdir)/m4/ax_require_defined.m4 \

deps/cares/RELEASE-NOTES

Lines changed: 45 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,57 @@
1-
c-ares version 1.18.1
1+
c-ares version 1.19.1
22

3-
This is an urgent bugfix release for a regression made in 1.18.0.
3+
This is a security and bugfix release.
44

5-
Bug fixes:
6-
o ares_getaddrinfo() would return ai_addrlen of 16 for ipv6
7-
adddresses rather than the sizeof(struct sockaddr_in6)
8-
9-
10-
11-
c-ares version 1.18.0
12-
13-
This is a feature and bugfix release. It addresses a couple of new feature
14-
requests as well as a couple of bug fixes.
5+
A special thanks goes out to the Open Source Technology Improvement Fund
6+
(https://ostif.org) for sponsoring a security audit of c-ares performed by X41
7+
(https://x41-dsec.de).
158

16-
Changes:
17-
o Add support for URI(Uniform Resource Identifier) records via
18-
ares_parse_uri_reply() [1]
19-
o Provide ares_nameser.h as a public interface as needed by NodeJS [5]
20-
o Update URLs from c-ares.haxx.se to c-ares.org [9]
21-
o During a domain search, treat ARES_ENODATA as ARES_NXDOMAIN so that the
22-
search process will continue to the next domain in the search. [11]
23-
o Turn ares_gethostbyname() into a wrapper for ares_getaddrinfo() as they
24-
followed very similar code paths and ares_gethostbyaddr() has some more
25-
desirable features such as priority sorting and parallel queries for
26-
AF_UNSPEC. [12]
27-
o ares_getaddrinfo() now contains a name element in the address info
28-
structure as the last element. This is not an API or ABI break due to
29-
the structure always being internally allocated and it being the last
30-
element. [12]
31-
o ares_parse_a_reply() and ares_parse_aaaa_reply() were nearly identical, those
32-
now use the same helper functions for parsing rather than having their own
33-
code. [12]
34-
o RFC6761 Section 6.3 says "localhost" lookups need to be special cased to
35-
return loopback addresses, and not forward queries to recursive dns servers.
36-
On Windows this now returns all loopback addresses, on other systems it
37-
returns 127.0.0.1 or ::1 always, and will never forward a request for
38-
"localhost" to outside DNS servers. [13]
39-
o Haiki: port [14]
9+
Security:
10+
o CVE-2023-32067. High. 0-byte UDP payload causes Denial of Service [12]
11+
o CVE-2023-31147. Moderate. Insufficient randomness in generation of DNS
12+
query IDs [13]
13+
o CVE-2023-31130. Moderate. Buffer Underwrite in ares_inet_net_pton() [14]
14+
o CVE-2023-31124. Low. AutoTools does not set CARES_RANDOM_FILE during cross
15+
compilation [15]
4016

4117
Bug fixes:
42-
o add build to .gitignore [2]
43-
o z/OS minor update, add missing semicolon in ares_init.c [3]
44-
o Fix building when latest ax_code_coverage.m4 is imported [4]
45-
o Work around autotools 'error: too many loops' and other newer autotools
46-
import related bugs.
47-
o MinGW cross builds need advapi32 link as lower case [6]
48-
o Cygwin build fix due to containing both socket.h and winsock2.h [7]
49-
o ares_expand_name should allow underscores (_) as SRV records legitimately use
50-
them [8]
51-
o Allow '/' as a valid character for a returned name for CNAME in-addr.arpa
52-
delegation [10]
53-
o ares_getaddrinfo() was not honoring HOSTALIASES [12]
54-
o ares_getaddrinfo() had some test cases disabled due to a bug in the test
55-
framework itself which has now been resolved [12]
56-
o Due to Travis-CI becoming unfriendly to open-source, Cirrus-CI has now been
57-
brought online for automated unit testing.
18+
o Fix uninitialized memory warning in test [1]
19+
o Turn off IPV6_V6ONLY on Windows to allow IPv4-mapped IPv6 addresses [2]
20+
o ares_getaddrinfo() should allow a port of 0 [3]
21+
o Fix memory leak in ares_send() on error [4]
22+
o Fix comment style in ares_data.h [5]
23+
o Remove unneeded ifdef for Windows [6]
24+
o Fix typo in ares_init_options.3 [7]
25+
o Re-add support for Watcom compiler [8]
26+
o Sync ax_pthread.m4 with upstream [9]
27+
o Windows: Invalid stack variable used out of scope for HOSTS path [10]
28+
o Sync ax_cxx_compile_stdcxx_11.m4 with upstream to fix uclibc support [11]
5829

5930
Thanks go to these friendly people for their efforts and contributions:
60-
Biswapriyo Nath (@Biswa96)
6131
Brad House (@bradh352)
62-
Daniel Bevenius (@danbev)
32+
@Chilledheart
6333
Daniel Stenberg (@bagder)
64-
Dhrumil Rana (@dhrumilrana)
65-
Felix Yan (@felixonmars)
66-
Jérôme Duval (@korli)
67-
Martin Holeš (@martin-256)
68-
Sinan Kaya
34+
Douglas R. Reno (@renodr)
35+
Gregor Jasny (@gjasny)
36+
Jay Freeman (@saurik)
37+
@lifenjoiner
38+
Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
39+
Yijie Ma (@yijiem)
6940
(9 contributors)
7041

7142
References to bug reports and discussions on issues:
72-
[1] = https://github.com/c-ares/c-ares/pull/411
73-
[2] = https://github.com/c-ares/c-ares/pull/410
74-
[3] = https://github.com/c-ares/c-ares/pull/414
75-
[4] = https://github.com/c-ares/c-ares/pull/418
76-
[5] = https://github.com/c-ares/c-ares/pull/417
77-
[6] = https://github.com/c-ares/c-ares/pull/420
78-
[7] = https://github.com/c-ares/c-ares/pull/422
79-
[8] = https://github.com/c-ares/c-ares/issues/424
80-
[9] = https://github.com/c-ares/c-ares/issues/423
81-
[10] = https://github.com/c-ares/c-ares/issues/427
82-
[11] = https://github.com/c-ares/c-ares/issues/426
83-
[12] = https://github.com/c-ares/c-ares/pull/428
84-
[13] = https://github.com/c-ares/c-ares/pull/430
85-
[14] = https://github.com/c-ares/c-ares/pull/431
43+
[1] = https://github.com/c-ares/c-ares/pull/515
44+
[2] = https://github.com/c-ares/c-ares/pull/520
45+
[3] = https://github.com/c-ares/c-ares/issues/517
46+
[4] = https://github.com/c-ares/c-ares/pull/511
47+
[5] = https://github.com/c-ares/c-ares/pull/513
48+
[6] = https://github.com/c-ares/c-ares/pull/512
49+
[7] = https://github.com/c-ares/c-ares/pull/510
50+
[8] = https://github.com/c-ares/c-ares/pull/509
51+
[9] = https://github.com/c-ares/c-ares/pull/507
52+
[10] = https://github.com/c-ares/c-ares/pull/502
53+
[11] = https://github.com/c-ares/c-ares/pull/505
54+
[12] = https://github.com/c-ares/c-ares/security/advisories/GHSA-9g78-jv2r-p7vc
55+
[13] = https://github.com/c-ares/c-ares/security/advisories/GHSA-8r8p-23f3-64c2
56+
[14] = https://github.com/c-ares/c-ares/security/advisories/GHSA-x6mf-cxr9-8q6v
57+
[15] = https://github.com/c-ares/c-ares/security/advisories/GHSA-54xr-f67r-4pc4

deps/cares/aclocal.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ m4_include([m4/ax_add_am_macro_static.m4])
11901190
m4_include([m4/ax_am_macros_static.m4])
11911191
m4_include([m4/ax_check_gnu_make.m4])
11921192
m4_include([m4/ax_code_coverage.m4])
1193+
m4_include([m4/ax_cxx_compile_stdcxx.m4])
11931194
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
11941195
m4_include([m4/ax_file_escapes.m4])
11951196
m4_include([m4/ax_require_defined.m4])

deps/cares/aminclude_static.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# aminclude_static.am generated automatically by Autoconf
3-
# from AX_AM_MACROS_STATIC on Wed Oct 27 08:06:13 CEST 2021
3+
# from AX_AM_MACROS_STATIC on Mon May 22 14:23:05 CEST 2023
44

55

66
# Code coverage

0 commit comments

Comments
 (0)