Skip to content

Commit 3914354

Browse files
committedAug 10, 2021
deps: update c-ares to 1.17.2
Refs: https://github.com/c-ares/c-ares/releases/tag/cares-1_17_2 PR-URL: nodejs#39724 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent f8ed755 commit 3914354

39 files changed

+889
-593
lines changed
 

‎deps/cares/RELEASE-NOTES

+66-55
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,79 @@
1-
c-ares version 1.17.1
1+
c-ares version 1.17.2
22

3-
Due to a packaging issue with 1.17.0, we have released 1.17.1 to address that
4-
issue. See 1.17.0 release notes below..
5-
6-
7-
c-ares version 1.17.0
3+
This is a security and bugfix release. It addresses a few security related
4+
issues along with various bugfixes mostly related to portability.
85

96
Security:
10-
o avoid read-heap-buffer-overflow in ares_parse_soa_reply found during
11-
fuzzing [2] [3]
12-
o Avoid theoretical buffer overflow in RC4 loop comparison [5]
13-
o Empty hquery->name could lead to invalid memory access [15]
14-
o ares_parse_{a,aaaa}_reply() could return a larger *naddrttls than was
15-
passed in [17]
7+
o NodeJS passes NULL for addr and 0 for addrlen to ares_parse_ptr_reply() on
8+
systems where malloc(0) returns NULL. This would cause a crash. [8]
9+
o When building c-ares with CMake, the RANDOM_FILE would not be set and
10+
therefore downgrade to the less secure random number generator [12]
11+
o If ares_getaddrinfo() was terminated by an ares_destroy(), it would cause
12+
a crash [13]
13+
o Crash in sortaddrinfo() if the list size equals 0 due to an unexpected
14+
DNS response [14]
15+
o Expand number of escaped characters in DNS replies as per RFC1035 5.1 to
16+
prevent spoofing [16], [17]
17+
o Perform validation on hostnames to prevent possible XSS due to applications
18+
not performing valiation themselves [18]
1619

1720
Changes:
18-
o Update help information for adig, acountry, and ahost [4]
19-
o Test Suite now uses dynamic system-assigned ports rather than hardcoded
20-
ports to prevent failures in containers [10]
21-
o Detect remote DNS server does not support EDNS using rules from RFC 6891 [12]
22-
o Source tree has been reorganized to use a more modern layout [13]
23-
o Allow parsing of CAA Resource Record [14]
21+
o Use non-blocking /dev/urandom for random data to prevent early startup
22+
performance issues [5]
23+
o z/OS port [6]
24+
o ares_malloc(0) is now defined behavior (returns NULL) rather than
25+
system-specific to catch edge cases [7]
2426

2527
Bug fixes:
26-
o readaddrinfo bad sizeof() [1]
27-
o Test cases should honor HAVE_WRITEV flag, not depend on WIN32 [6]
28-
o FQDN with trailing period should be queried first [7]
29-
o ares_getaddrinfo() was returning members of the struct as garbage values if
30-
unset, and was not honoring ai_socktype and ai_protocol hints. [8] [9]
31-
o ares_gethostbyname() with AF_UNSPEC and an ip address would fail [11]
32-
o Properly document ares_set_local_ip4() uses host byte order [16]
28+
o Fuzz testing files were not distributed with official archives [1]
29+
o Building tests should not force building of static libraries except on
30+
Windows [2]
31+
o Windows builds of the tools would fail if built as static due to a missing
32+
CARES_STATICLIB definition [3]
33+
o Relative headers must use double quotes to prevent pulling in a system
34+
library [4]
35+
o Fix OpenBSD building by implementing portability updates for including
36+
arpa/nameser.h [9]
37+
o Fix building out-of-tree for autotools [10]
38+
o Make install on MacOS/iOS with CMake was missing the bundle destination so
39+
libraries weren't actually installed [11]
40+
o Fix retrieving DNS server configuration on MacOS and iOS if the configuration
41+
did not include search domains [15]
42+
o ares_parse_a_reply and ares_parse_aaa_reply were erroneously using strdup()
43+
instead of ares_strdup() [19]
44+
3345

3446
Thanks go to these friendly people for their efforts and contributions:
35-
@anonymoushelpishere
36-
Anthony Penniston (@apenn-msft)
47+
Anton Danielsson (@anton-danielsson)
3748
Brad House (@bradh352)
38-
Bulat Gaifullin (@bgaifullin)
39-
Daniela Sonnenschein (@lxdicted)
4049
Daniel Stenberg (@bagder)
41-
David Hotham (@dimbleby)
42-
Fionn Fitzmaurice (@fionn)
43-
Gisle Vanem (@gavenm)
44-
Ivan Baidakou (@basiliscos)
45-
Jonathan Maye-Hobbs (@wheelpharoah)
46-
Łukasz Marszał (@lmarszal)
47-
lutianxiong (@ltx2018)
48-
Seraphime Kirkovski (@Seraphime)
49-
(14 contributors)
50+
Dhrumil Rana (@dhrumilrana)
51+
František Dvořák (@valtri)
52+
@halx99
53+
Jay Freeman (@saurik)
54+
Jean-pierre Cartal (@jeanpierrecartal)
55+
Michael Kourlas
56+
Philipp Jeitner
57+
@vburdo
58+
(11 contributors)
5059

5160
References to bug reports and discussions on issues:
52-
[1] = https://github.com/c-ares/c-ares/pull/331
53-
[2] = https://github.com/c-ares/c-ares/pull/332
54-
[3] = https://github.com/c-ares/c-ares/issues/333
55-
[4] = https://github.com/c-ares/c-ares/pull/334
56-
[5] = https://github.com/c-ares/c-ares/pull/336
57-
[6] = https://github.com/c-ares/c-ares/pull/344
58-
[7] = https://github.com/c-ares/c-ares/pull/345
59-
[8] = https://github.com/c-ares/c-ares/issues/343
60-
[9] = https://github.com/c-ares/c-ares/issues/317
61-
[10] = https://github.com/c-ares/c-ares/pull/346
62-
[11] = https://github.com/c-ares/c-ares/pull/204
63-
[12] = https://github.com/c-ares/c-ares/pull/244
64-
[13] = https://github.com/c-ares/c-ares/pull/349
65-
[14] = https://github.com/c-ares/c-ares/pull/360
66-
[15] = https://github.com/c-ares/c-ares/pull/367
67-
[16] = https://github.com/c-ares/c-ares/pull/368
68-
[17] = https://github.com/c-ares/c-ares/issues/371
61+
[1] = https://github.com/c-ares/c-ares/issues/379
62+
[2] = https://github.com/c-ares/c-ares/issues/380
63+
[3] = https://github.com/c-ares/c-ares/issues/384
64+
[4] = https://github.com/c-ares/c-ares/pull/386
65+
[5] = https://github.com/c-ares/c-ares/pull/391
66+
[6] = https://github.com/c-ares/c-ares/pull/390
67+
[7] = https://github.com/c-ares/c-ares/commit/485fb66
68+
[8] = https://github.com/c-ares/c-ares/issues/392
69+
[9] = https://github.com/c-ares/c-ares/issues/388
70+
[10] = https://github.com/c-ares/c-ares/pull/394
71+
[11] = https://github.com/c-ares/c-ares/pull/395
72+
[12] = https://github.com/c-ares/c-ares/pull/397
73+
[13] = https://github.com/c-ares/c-ares/commit/df94703
74+
[14] = https://github.com/c-ares/c-ares/pull/400
75+
[15] = https://github.com/c-ares/c-ares/pull/401
76+
[16] = https://github.com/c-ares/c-ares/commit/362f91d
77+
[17] = https://github.com/c-ares/c-ares/commit/44c009b
78+
[18] = https://github.com/c-ares/c-ares/commit/c9b6c60
79+
[19] = https://github.com/c-ares/c-ares/pull/408

‎deps/cares/cares.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'src/lib/ares_llist.c',
6767
'src/lib/ares_llist.h',
6868
'src/lib/ares_mkquery.c',
69+
'src/lib/ares_nameser.h',
6970
'src/lib/ares_nowarn.c',
7071
'src/lib/ares_nowarn.h',
7172
'src/lib/ares_options.c',
@@ -106,7 +107,6 @@
106107
'src/lib/inet_net_pton.c',
107108
'src/lib/inet_ntop.c',
108109
'src/lib/ares_inet_net_pton.h',
109-
'src/lib/nameser.h',
110110
'src/lib/setup_once.h',
111111
'src/tools/ares_getopt.c',
112112
'src/tools/ares_getopt.h',

‎deps/cares/include/ares.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
4040
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
4141
defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
42-
defined(__QNXNTO__)
42+
defined(__QNXNTO__) || defined(__MVS__)
4343
#include <sys/select.h>
4444
#endif
4545
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))

‎deps/cares/include/ares_version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
#define ARES_VERSION_MAJOR 1
99
#define ARES_VERSION_MINOR 17
10-
#define ARES_VERSION_PATCH 1
10+
#define ARES_VERSION_PATCH 2
1111
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
1212
(ARES_VERSION_MINOR<<8)|\
1313
(ARES_VERSION_PATCH))
14-
#define ARES_VERSION_STR "1.17.1"
14+
#define ARES_VERSION_STR "1.17.2"
1515

1616
#if (ARES_VERSION >= 0x010700)
1717
# define CARES_HAVE_ARES_LIBRARY_INIT 1

‎deps/cares/src/lib/ares__parse_into_addrinfo.c

+5-11
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@
2424
#ifdef HAVE_ARPA_INET_H
2525
# include <arpa/inet.h>
2626
#endif
27-
#ifdef HAVE_ARPA_NAMESER_H
28-
# include <arpa/nameser.h>
29-
#else
30-
# include "nameser.h"
31-
#endif
32-
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
33-
# include <arpa/nameser_compat.h>
34-
#endif
27+
28+
#include "ares_nameser.h"
3529

3630
#ifdef HAVE_STRINGS_H
3731
# include <strings.h>
@@ -76,7 +70,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf,
7670

7771
/* Expand the name from the question, and skip past the question. */
7872
aptr = abuf + HFIXEDSZ;
79-
status = ares__expand_name_for_response(aptr, abuf, alen, question_hostname, &len);
73+
status = ares__expand_name_for_response(aptr, abuf, alen, question_hostname, &len, 0);
8074
if (status != ARES_SUCCESS)
8175
return status;
8276
if (aptr + len + QFIXEDSZ > abuf + alen)
@@ -92,7 +86,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf,
9286
for (i = 0; i < (int)ancount; i++)
9387
{
9488
/* Decode the RR up to the data field. */
95-
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
89+
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len, 0);
9690
if (status != ARES_SUCCESS)
9791
{
9892
rr_name = NULL;
@@ -194,7 +188,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf,
194188
{
195189
got_cname = 1;
196190
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
197-
&len);
191+
&len, 1);
198192
if (status != ARES_SUCCESS)
199193
{
200194
goto failed_stat;

‎deps/cares/src/lib/ares__sortaddrinfo.c

+4
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,10 @@ int ares__sortaddrinfo(ares_channel channel, struct ares_addrinfo_node *list_sen
453453
++nelem;
454454
cur = cur->ai_next;
455455
}
456+
457+
if (!nelem)
458+
return ARES_ENODATA;
459+
456460
elems = (struct addrinfo_sort_elem *)ares_malloc(
457461
nelem * sizeof(struct addrinfo_sort_elem));
458462
if (!elems)

‎deps/cares/src/lib/ares_create_query.c

+4-13
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,13 @@
1919
#ifdef HAVE_NETINET_IN_H
2020
# include <netinet/in.h>
2121
#endif
22-
#ifdef HAVE_ARPA_NAMESER_H
23-
# include <arpa/nameser.h>
24-
#else
25-
# include "nameser.h"
26-
#endif
27-
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
28-
# include <arpa/nameser_compat.h>
29-
#endif
22+
23+
#include "ares_nameser.h"
3024

3125
#include "ares.h"
3226
#include "ares_dns.h"
3327
#include "ares_private.h"
3428

35-
#ifndef T_OPT
36-
# define T_OPT 41 /* EDNS0 option (meta-RR) */
37-
#endif
3829

3930
/* Header format, from RFC 1035:
4031
* 1 1 1 1 1 1
@@ -57,7 +48,7 @@
5748
* of the remaining fields:
5849
* ID Identifier to match responses with queries
5950
* QR Query (0) or response (1)
60-
* Opcode For our purposes, always QUERY
51+
* Opcode For our purposes, always O_QUERY
6152
* RD Recursion desired
6253
* Z Reserved (zero)
6354
* QDCOUNT Number of queries
@@ -116,7 +107,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
116107
q = buf;
117108
memset(q, 0, HFIXEDSZ);
118109
DNS_HEADER_SET_QID(q, id);
119-
DNS_HEADER_SET_OPCODE(q, QUERY);
110+
DNS_HEADER_SET_OPCODE(q, O_QUERY);
120111
if (rd) {
121112
DNS_HEADER_SET_RD(q, 1);
122113
}

0 commit comments

Comments
 (0)