Skip to content

Commit 353a567

Browse files
codebytereMylesBorins
authored andcommitted
deps: upgrade to c-ares v1.16.1
PR-URL: #35324 Refs: https://github.com/c-ares/c-ares/releases/tag/cares-1_16_1 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 5da5d41 commit 353a567

File tree

9 files changed

+45
-94
lines changed

9 files changed

+45
-94
lines changed

deps/cares/include/ares_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
#define ARES_VERSION_MAJOR 1
99
#define ARES_VERSION_MINOR 16
10-
#define ARES_VERSION_PATCH 0
10+
#define ARES_VERSION_PATCH 1
1111
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
1212
(ARES_VERSION_MINOR<<8)|\
1313
(ARES_VERSION_PATCH))
14-
#define ARES_VERSION_STR "1.16.0"
14+
#define ARES_VERSION_STR "1.16.1"
1515

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

deps/cares/src/RELEASE-NOTES

Lines changed: 22 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,30 @@
1-
c-ares version 1.16.0
1+
c-ares version 1.16.1
2+
3+
Security:
4+
o Prevent possible use-after-free and double-free in ares_getaddrinfo() if
5+
ares_destroy() is called prior to ares_getaddrinfo() completing. Reported
6+
by Jann Horn at Google Project Zero.
27

38
Changes:
4-
o Introduction of ares_getaddrinfo() API which provides similar output
5-
(including proper sorting as per RFC 6724) to the system native API, but
6-
utilizes different data structures in order to provide additional information
7-
such as TTLs and all aliases. Please reference the respective man pages for
8-
usage details. [3] [4] [5] [7] [8] [13] [14] [15] [16] [17] [22]
9-
o Parse SOA records from ns_t_any response [29] [30]
10-
o CMake: Provide c-ares version in package export file [24]
11-
o CMake: Add CPACK functionality for DEB and RPM [28]
12-
o CMake: Generate PDB files during build [33] [34]
13-
o CMake: Support manpage installation [37] [38]
9+
o Allow TXT records on CHAOS qclass. Used for retriving things like
10+
version.bind, version.server, authoris.bind, hostname.bind, and id.server.
11+
[3]
1412

1513
Bug fixes:
16-
o Fix bad expectation in IPv6 localhost test. [1] [2]
17-
o AutoTools: use XC_CHECK_BUILD_FLAGS instead of XC_CHECK_USER_FLAGS to prevent
18-
complaints about CPPFLAGS in CFLAGS. [6]
19-
o Fix .onion handling
20-
o Command line usage was out of date for adig and ahost. [18]
21-
o Typos in manpages [19] [20]
22-
o If ares_getenv is defined, it must return a value on all platforms [21]
23-
o If /etc/resolv.conf has invalid lookup values, use the defaults. [23]
24-
o Tests: Separate live tests from SetServers* tests as only live tests should
25-
require internet access. [25]
26-
o ares_gethostbyname() should return ENODATA if no valid A or AAAA record is
27-
found, but a CNAME was found. [26] [27]
28-
o CMake: Rework library function checking to prevent unintended linking with
29-
system libraries that aren't needed. [31] [32]
30-
o Due to use of inet_addr() it was not possible to return 255.255.255.255 from
31-
ares_gethostbyname(). [35] [36]
32-
o CMake: Fix building of tests on Windows
14+
o Fix Windows Unicode incompatibilities with ares_getaddrinfo() [1]
15+
o Silence false cast-align compiler warnings due to valid casts of
16+
struct sockaddr to struct sockaddr_in and struct sockaddr_in6.
17+
o MacOS should use libresolv for retrieving DNS servers, like iOS
18+
o CMake build system should populate the INCLUDE_DIRECTORIES property of
19+
installed targets [2]
20+
o Correct macros in use for the ares_getaddrinfo.3 man page
3321

3422
Thanks go to these friendly people for their efforts and contributions:
35-
Abhishek Arya (@inferno-chromium), Adam Majer (@AdamMajer),
36-
Andrew Selivanov (@ki11roy), Ben Noordhuis (@bnoordhuis),
37-
Brad House (@bradh352), Christian Ammer (@ChristianAmmer), Dan Noé (@dnoe),
38-
Daniel Stenberg (@bagder), Darrin Cullop (@dwcullop),
39-
Dron Rathore (@DronRathore), Fabrice Fontaine (@ffontaine),
40-
Gregor Jasny (@gjasny), @kedixa, Khaidi Chu (@XadillaX),
41-
Kyle Edwards (@KyleFromKitware), @lifenjoiner, Michal Rostecki (@mrostecki),
42-
Peter Eisentraut (@petere), Piotr Pietraszkiewicz (@ppietrasa),
43-
Stephen Bryant (@bf-bryants), @tjwalton, Vy Nguyen (@oontvoo)
44-
(22 contributors)
23+
Brad House (@bradh352), Daniel Stenberg (@bagder), Dmitry Igrishin (@dmitigr),
24+
Jann Horn, Shelly Vohr, Teemu R (@rytilahti)
25+
(6 contributors)
4526

4627
References to bug reports and discussions on issues:
47-
[1] = https://github.com/c-ares/c-ares/pull/227
48-
[2] = https://github.com/c-ares/c-ares/issues/85
49-
[3] = https://github.com/c-ares/c-ares/pull/112
50-
[4] = https://github.com/c-ares/c-ares/pull/233
51-
[5] = https://github.com/c-ares/c-ares/pull/234
52-
[6] = https://github.com/c-ares/c-ares/pull/236
53-
[7] = https://github.com/c-ares/c-ares/pull/235
54-
[8] = https://github.com/c-ares/c-ares/pull/239
55-
[9] = https://github.com/c-ares/c-ares/pull/241
56-
[10] = https://github.com/c-ares/c-ares/pull/187
57-
[11] = https://github.com/c-ares/c-ares/pull/252
58-
[12] = https://github.com/c-ares/c-ares/issues/251
59-
[13] = https://github.com/c-ares/c-ares/pull/258
60-
[14] = https://github.com/c-ares/c-ares/pull/257
61-
[15] = https://github.com/c-ares/c-ares/pull/262
62-
[16] = https://github.com/c-ares/c-ares/pull/264
63-
[17] = https://github.com/c-ares/c-ares/pull/265
64-
[18] = https://github.com/c-ares/c-ares/pull/256
65-
[19] = https://github.com/c-ares/c-ares/pull/269
66-
[20] = https://github.com/c-ares/c-ares/pull/275
67-
[21] = https://github.com/c-ares/c-ares/pull/279
68-
[22] = https://github.com/c-ares/c-ares/pull/290
69-
[23] = https://github.com/c-ares/c-ares/pull/274
70-
[24] = https://github.com/c-ares/c-ares/pull/296
71-
[25] = https://github.com/c-ares/c-ares/pull/299
72-
[26] = https://github.com/c-ares/c-ares/pull/304
73-
[27] = https://github.com/c-ares/c-ares/issues/303
74-
[28] = https://github.com/c-ares/c-ares/pull/283
75-
[29] = https://github.com/c-ares/c-ares/pull/103
76-
[30] = https://github.com/c-ares/c-ares/issues/102
77-
[31] = https://github.com/c-ares/c-ares/pull/310
78-
[32] = https://github.com/c-ares/c-ares/issues/307
79-
[33] = https://github.com/c-ares/c-ares/pull/311
80-
[34] = https://github.com/c-ares/c-ares/issues/245
81-
[35] = https://github.com/c-ares/c-ares/issues/309
82-
[36] = https://github.com/c-ares/c-ares/pull/312
83-
[37] = https://github.com/c-ares/c-ares/issues/297
84-
[38] = https://github.com/c-ares/c-ares/pull/314
85-
28+
[1] = https://github.com/c-ares/c-ares/pull/328
29+
[2] = https://github.com/c-ares/c-ares/pull/323
30+
[3] = https://github.com/c-ares/c-ares/pull/321

deps/cares/src/ares_getaddrinfo.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,11 @@ static void end_hquery(struct host_query *hquery, int status)
408408
{
409409
if (next->ai_family == AF_INET)
410410
{
411-
((struct sockaddr_in *)next->ai_addr)->sin_port = htons(hquery->port);
411+
(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port);
412412
}
413413
else
414414
{
415-
((struct sockaddr_in6 *)next->ai_addr)->sin6_port = htons(hquery->port);
415+
(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr))->sin6_port = htons(hquery->port);
416416
}
417417
next = next->ai_next;
418418
}
@@ -456,18 +456,18 @@ static int file_lookup(struct host_query *hquery)
456456
char tmp[MAX_PATH];
457457
HKEY hkeyHosts;
458458

459-
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
459+
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
460460
&hkeyHosts) == ERROR_SUCCESS)
461461
{
462462
DWORD dwLength = MAX_PATH;
463-
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
463+
RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
464464
&dwLength);
465-
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
465+
ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH);
466466
RegCloseKey(hkeyHosts);
467467
}
468468
}
469469
else if (platform == WIN_9X)
470-
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
470+
GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH);
471471
else
472472
return ARES_ENOTFOUND;
473473

@@ -548,6 +548,7 @@ static void host_callback(void *arg, int status, int timeouts,
548548
else if (status == ARES_EDESTRUCTION)
549549
{
550550
end_hquery(hquery, status);
551+
return;
551552
}
552553

553554
if (!hquery->remaining)

deps/cares/src/ares_getnameinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
9292
if ((sa->sa_family == AF_INET) &&
9393
(salen == sizeof(struct sockaddr_in)))
9494
{
95-
addr = (struct sockaddr_in *)sa;
95+
addr = CARES_INADDR_CAST(struct sockaddr_in *, sa);
9696
port = addr->sin_port;
9797
}
9898
else if ((sa->sa_family == AF_INET6) &&
9999
(salen == sizeof(struct sockaddr_in6)))
100100
{
101-
addr6 = (struct sockaddr_in6 *)sa;
101+
addr6 = CARES_INADDR_CAST(struct sockaddr_in6 *, sa);
102102
port = addr6->sin6_port;
103103
}
104104
else

deps/cares/src/ares_parse_a_reply.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
163163
{
164164
hostent->h_addr_list[i] = (char *)&addrs[i];
165165
memcpy(hostent->h_addr_list[i],
166-
&(((struct sockaddr_in *)next->ai_addr)->sin_addr),
166+
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
167167
sizeof(struct in_addr));
168168
if (naddrttls && i < *naddrttls)
169169
{
@@ -173,7 +173,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
173173
addrttls[i].ttl = next->ai_ttl;
174174

175175
memcpy(&addrttls[i].ipaddr,
176-
&(((struct sockaddr_in *)next->ai_addr)->sin_addr),
176+
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
177177
sizeof(struct in_addr));
178178
}
179179
++i;

deps/cares/src/ares_parse_aaaa_reply.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
165165
{
166166
hostent->h_addr_list[i] = (char*)&addrs[i];
167167
memcpy(hostent->h_addr_list[i],
168-
&(((struct sockaddr_in6 *)next->ai_addr)->sin6_addr),
168+
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
169169
sizeof(struct ares_in6_addr));
170170
if (naddrttls && i < *naddrttls)
171171
{
@@ -175,7 +175,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
175175
addrttls[i].ttl = next->ai_ttl;
176176

177177
memcpy(&addrttls[i].ip6addr,
178-
&(((struct sockaddr_in6 *)next->ai_addr)->sin6_addr),
178+
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
179179
sizeof(struct ares_in6_addr));
180180
}
181181
++i;

deps/cares/src/ares_parse_txt_reply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ ares__parse_txt_reply (const unsigned char *abuf, int alen,
113113
}
114114

115115
/* Check if we are really looking at a TXT record */
116-
if (rr_class == C_IN && rr_type == T_TXT)
116+
if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_TXT)
117117
{
118118
/*
119119
* There may be multiple substrings in a single TXT record. Each

deps/cares/src/ares_private.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
#define STATIC_TESTABLE static
5151
#endif
5252

53+
/* By using a double cast, we can get rid of the bogus warning of
54+
* warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' increases required alignment from 1 to 4 [-Wcast-align]
55+
*/
56+
#define CARES_INADDR_CAST(type, var) ((type)((void *)var))
57+
5358
#if defined(WIN32) && !defined(WATT32)
5459

5560
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"

deps/cares/src/ares_process.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,13 +1337,13 @@ static int same_address(struct sockaddr *sa, struct ares_addr *aa)
13371337
{
13381338
case AF_INET:
13391339
addr1 = &aa->addrV4;
1340-
addr2 = &((struct sockaddr_in *)sa)->sin_addr;
1340+
addr2 = &(CARES_INADDR_CAST(struct sockaddr_in *, sa))->sin_addr;
13411341
if (memcmp(addr1, addr2, sizeof(aa->addrV4)) == 0)
13421342
return 1; /* match */
13431343
break;
13441344
case AF_INET6:
13451345
addr1 = &aa->addrV6;
1346-
addr2 = &((struct sockaddr_in6 *)sa)->sin6_addr;
1346+
addr2 = &(CARES_INADDR_CAST(struct sockaddr_in6 *, sa))->sin6_addr;
13471347
if (memcmp(addr1, addr2, sizeof(aa->addrV6)) == 0)
13481348
return 1; /* match */
13491349
break;

0 commit comments

Comments
 (0)