GeezerVison is showing github.com — deps: update to c-ares 1.17.1 · nodejs/node@5747dff
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/cares/include/ares_version.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | | 7 | 7 |
| 8 | 8 | #define ARES_VERSION_MAJOR 1 | 9 | | -#define ARES_VERSION_MINOR 16 | | 9 | +#define ARES_VERSION_MINOR 17 | 10 | 10 | #define ARES_VERSION_PATCH 1 | 11 | 11 | #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ | 12 | 12 | (ARES_VERSION_MINOR<<8)|\ | 13 | 13 | (ARES_VERSION_PATCH)) | 14 | | -#define ARES_VERSION_STR "1.16.1" | | 14 | +#define ARES_VERSION_STR "1.17.1" | 15 | 15 |
| 16 | 16 | #if (ARES_VERSION >= 0x010700) | 17 | 17 | # define CARES_HAVE_ARES_LIBRARY_INIT 1 | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/include/nameser.h +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,7 +88,7 @@ typedef enum __ns_type { | 88 | 88 | ns_t_maila = 254, /* Transfer mail agent records. */ | 89 | 89 | ns_t_any = 255, /* Wildcard match. */ | 90 | 90 | ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ | 91 | | - ns_t_caa = 257, /* CA Authorization (RFC8659) */ | | 91 | + ns_t_caa = 257, /* Certification Authority Authorization. */ | 92 | 92 | ns_t_max = 65536 | 93 | 93 | } ns_type; | 94 | 94 |
| @@ -210,4 +210,9 @@ typedef enum __ns_rcode { | 210 | 210 |
| 211 | 211 | #endif /* HAVE_ARPA_NAMESER_COMPAT_H */ | 212 | 212 |
| | 213 | +/* Android's bionic arpa/nameser_compat.h, nor glibc versions prior to 2.25 have T_OPT defined */ | | 214 | +#ifndef T_OPT | | 215 | +# define T_OPT ns_t_opt | | 216 | +#endif | | 217 | + | 213 | 218 | #endif /* ARES_NAMESER_H */ |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares__readaddrinfo.c +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -163,6 +163,10 @@ int ares__readaddrinfo(FILE *fp, | 163 | 163 | continue; | 164 | 164 | } | 165 | 165 |
| | 166 | + /* Zero-out 'addr' struct, as there are members that we may not set, especially | | 167 | + * for ipv6. We don't want garbage data */ | | 168 | + memset(&addr, 0, sizeof(addr)); | | 169 | + | 166 | 170 | /* | 167 | 171 | * Convert address string to network address for the requested families. | 168 | 172 | * Actual address family possible values are AF_INET and AF_INET6 only. | @@ -179,7 +183,7 @@ int ares__readaddrinfo(FILE *fp, | 179 | 183 | } | 180 | 184 |
| 181 | 185 | node->ai_family = addr.sa.sa_family = AF_INET; | 182 | | - node->ai_addrlen = sizeof(sizeof(addr.sa4)); | | 186 | + node->ai_addrlen = sizeof(addr.sa4); | 183 | 187 | node->ai_addr = ares_malloc(sizeof(addr.sa4)); | 184 | 188 | if (!node->ai_addr) | 185 | 189 | { | @@ -200,7 +204,7 @@ int ares__readaddrinfo(FILE *fp, | 200 | 204 | } | 201 | 205 |
| 202 | 206 | node->ai_family = addr.sa.sa_family = AF_INET6; | 203 | | - node->ai_addrlen = sizeof(sizeof(addr.sa6)); | | 207 | + node->ai_addrlen = sizeof(addr.sa6); | 204 | 208 | node->ai_addr = ares_malloc(sizeof(addr.sa6)); | 205 | 209 | if (!node->ai_addr) | 206 | 210 | { | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares__sortaddrinfo.c +11-10Lines changed: 11 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -85,11 +85,12 @@ struct addrinfo_sort_elem | 85 | 85 | #define ARES_IN6_IS_ADDR_6BONE(a) \ | 86 | 86 | (((a)->s6_addr[0] == 0x3f) && ((a)->s6_addr[1] == 0xfe)) | 87 | 87 |
| | 88 | + | 88 | 89 | static int get_scope(const struct sockaddr *addr) | 89 | 90 | { | 90 | 91 | if (addr->sa_family == AF_INET6) | 91 | 92 | { | 92 | | - const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr; | | 93 | + const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); | 93 | 94 | if (IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr)) | 94 | 95 | { | 95 | 96 | return ARES_IPV6_ADDR_MC_SCOPE(&addr6->sin6_addr); | @@ -114,7 +115,7 @@ static int get_scope(const struct sockaddr *addr) | 114 | 115 | } | 115 | 116 | else if (addr->sa_family == AF_INET) | 116 | 117 | { | 117 | | - const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addr; | | 118 | + const struct sockaddr_in *addr4 = CARES_INADDR_CAST(const struct sockaddr_in *, addr); | 118 | 119 | unsigned long int na = ntohl(addr4->sin_addr.s_addr); | 119 | 120 | if (ARES_IN_LOOPBACK(na) || /* 127.0.0.0/8 */ | 120 | 121 | (na & 0xffff0000) == 0xa9fe0000) /* 169.254.0.0/16 */ | @@ -149,7 +150,7 @@ static int get_label(const struct sockaddr *addr) | 149 | 150 | } | 150 | 151 | else if (addr->sa_family == AF_INET6) | 151 | 152 | { | 152 | | - const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr; | | 153 | + const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); | 153 | 154 | if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr)) | 154 | 155 | { | 155 | 156 | return 0; | @@ -210,7 +211,7 @@ static int get_precedence(const struct sockaddr *addr) | 210 | 211 | } | 211 | 212 | else if (addr->sa_family == AF_INET6) | 212 | 213 | { | 213 | | - const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr; | | 214 | + const struct sockaddr_in6 *addr6 = CARES_INADDR_CAST(const struct sockaddr_in6 *, addr); | 214 | 215 | if (IN6_IS_ADDR_LOOPBACK(&addr6->sin6_addr)) | 215 | 216 | { | 216 | 217 | return 50; | @@ -353,10 +354,10 @@ static int rfc6724_compare(const void *ptr1, const void *ptr2) | 353 | 354 | { | 354 | 355 | const struct sockaddr_in6 *a1_src = &a1->src_addr.sa6; | 355 | 356 | const struct sockaddr_in6 *a1_dst = | 356 | | - (const struct sockaddr_in6 *)a1->ai->ai_addr; | | 357 | + CARES_INADDR_CAST(const struct sockaddr_in6 *, a1->ai->ai_addr); | 357 | 358 | const struct sockaddr_in6 *a2_src = &a2->src_addr.sa6; | 358 | 359 | const struct sockaddr_in6 *a2_dst = | 359 | | - (const struct sockaddr_in6 *)a2->ai->ai_addr; | | 360 | + CARES_INADDR_CAST(const struct sockaddr_in6 *, a2->ai->ai_addr); | 360 | 361 | prefixlen1 = common_prefix_len(&a1_src->sin6_addr, &a1_dst->sin6_addr); | 361 | 362 | prefixlen2 = common_prefix_len(&a2_src->sin6_addr, &a2_dst->sin6_addr); | 362 | 363 | if (prefixlen1 != prefixlen2) | @@ -384,7 +385,7 @@ static int find_src_addr(ares_channel channel, | 384 | 385 | const struct sockaddr *addr, | 385 | 386 | struct sockaddr *src_addr) | 386 | 387 | { | 387 | | - int sock; | | 388 | + ares_socket_t sock; | 388 | 389 | int ret; | 389 | 390 | ares_socklen_t len; | 390 | 391 |
| @@ -402,7 +403,7 @@ static int find_src_addr(ares_channel channel, | 402 | 403 | } | 403 | 404 |
| 404 | 405 | sock = ares__open_socket(channel, addr->sa_family, SOCK_DGRAM, IPPROTO_UDP); | 405 | | - if (sock == -1) | | 406 | + if (sock == ARES_SOCKET_BAD) | 406 | 407 | { | 407 | 408 | if (errno == EAFNOSUPPORT) | 408 | 409 | { | @@ -426,7 +427,7 @@ static int find_src_addr(ares_channel channel, | 426 | 427 | return 0; | 427 | 428 | } | 428 | 429 |
| 429 | | - if (getsockname(sock, src_addr, &len) == -1) | | 430 | + if (getsockname(sock, src_addr, &len) != 0) | 430 | 431 | { | 431 | 432 | ares__close_socket(channel, sock); | 432 | 433 | return -1; | @@ -491,4 +492,4 @@ int ares__sortaddrinfo(ares_channel channel, struct ares_addrinfo_node *list_sen | 491 | 492 |
| 492 | 493 | ares_free(elems); | 493 | 494 | return ARES_SUCCESS; | 494 | | -} | | 495 | +} |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_getaddrinfo.c +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -386,6 +386,9 @@ static int fake_addrinfo(const char *name, | 386 | 386 | } | 387 | 387 | } | 388 | 388 |
| | 389 | + node->ai_socktype = hints->ai_socktype; | | 390 | + node->ai_protocol = hints->ai_protocol; | | 391 | + | 389 | 392 | callback(arg, ARES_SUCCESS, 0, ai); | 390 | 393 | return 1; | 391 | 394 | } | @@ -406,6 +409,8 @@ static void end_hquery(struct host_query *hquery, int status) | 406 | 409 | /* Set port into each address (resolved separately). */ | 407 | 410 | while (next) | 408 | 411 | { | | 412 | + next->ai_socktype = hquery->hints.ai_socktype; | | 413 | + next->ai_protocol = hquery->hints.ai_protocol; | 409 | 414 | if (next->ai_family == AF_INET) | 410 | 415 | { | 411 | 416 | (CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port); | @@ -754,12 +759,18 @@ static int as_is_first(const struct host_query* hquery) | 754 | 759 | { | 755 | 760 | char* p; | 756 | 761 | int ndots = 0; | | 762 | + size_t nname = strlen(hquery->name); | 757 | 763 | for (p = hquery->name; *p; p++) | 758 | 764 | { | 759 | 765 | if (*p == '.') | 760 | 766 | { | 761 | 767 | ndots++; | 762 | 768 | } | 763 | 769 | } | | 770 | + if (nname && hquery->name[nname-1] == '.') | | 771 | + { | | 772 | + /* prevent ARES_EBADNAME for valid FQDN, where ndots < channel->ndots */ | | 773 | + return 1; | | 774 | + } | 764 | 775 | return ndots >= hquery->channel->ndots; | 765 | 776 | } |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_gethostbyaddr.c -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -208,7 +208,6 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host) | 208 | 208 | strcat(PATH_HOSTS, WIN_PATH_HOSTS); | 209 | 209 |
| 210 | 210 | #elif defined(WATT32) | 211 | | - extern const char *_w32_GetHostsFile (void); | 212 | 211 | const char *PATH_HOSTS = _w32_GetHostsFile(); | 213 | 212 |
| 214 | 213 | if (!PATH_HOSTS) | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_gethostbyname.c +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -258,7 +258,7 @@ static int fake_hostent(const char *name, int family, | 258 | 258 | struct in_addr in; | 259 | 259 | struct ares_in6_addr in6; | 260 | 260 |
| 261 | | - if (family == AF_INET || family == AF_INET6) | | 261 | + if (family == AF_INET || family == AF_UNSPEC) | 262 | 262 | { | 263 | 263 | /* It only looks like an IP address if it's all numbers and dots. */ | 264 | 264 | int numdots = 0, valid = 1; | @@ -276,13 +276,17 @@ static int fake_hostent(const char *name, int family, | 276 | 276 | /* if we don't have 3 dots, it is illegal | 277 | 277 | * (although inet_pton doesn't think so). | 278 | 278 | */ | 279 | | - if (numdots != 3 || !valid) | | 279 | + if (numdots != 3 || !valid) { | 280 | 280 | result = 0; | 281 | | - else | | 281 | + } else { | 282 | 282 | result = (ares_inet_pton(AF_INET, name, &in) < 1 ? 0 : 1); | | 283 | + } | 283 | 284 |
| 284 | | - if (result) | 285 | | - family = AF_INET; | | 285 | + /* | | 286 | + * Set address family in case of failure, | | 287 | + * as we will try to convert it later afterwards | | 288 | + */ | | 289 | + family = result ? AF_INET : AF_INET6; | 286 | 290 | } | 287 | 291 | if (family == AF_INET6) | 288 | 292 | result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); | @@ -383,7 +387,6 @@ static int file_lookup(const char *name, int family, struct hostent **host) | 383 | 387 | strcat(PATH_HOSTS, WIN_PATH_HOSTS); | 384 | 388 |
| 385 | 389 | #elif defined(WATT32) | 386 | | - extern const char *_w32_GetHostsFile (void); | 387 | 390 | const char *PATH_HOSTS = _w32_GetHostsFile(); | 388 | 391 |
| 389 | 392 | if (!PATH_HOSTS) | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_init.c +4-16Lines changed: 4 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -115,20 +115,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, | 115 | 115 | int status = ARES_SUCCESS; | 116 | 116 | struct timeval now; | 117 | 117 |
| 118 | | -#ifdef CURLDEBUG | 119 | | - const char *env = getenv("CARES_MEMDEBUG"); | 120 | | - | 121 | | - if (env) | 122 | | - curl_memdebug(env); | 123 | | - env = getenv("CARES_MEMLIMIT"); | 124 | | - if (env) { | 125 | | - char *endptr; | 126 | | - long num = strtol(env, &endptr, 10); | 127 | | - if((endptr != env) && (endptr == env + strlen(env)) && (num > 0)) | 128 | | - curl_memlimit(num); | 129 | | - } | 130 | | -#endif | 131 | | - | 132 | 118 | if (ares_library_initialized() != ARES_SUCCESS) | 133 | 119 | return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ | 134 | 120 |
| @@ -1611,7 +1597,8 @@ static int init_by_resolv_conf(ares_channel channel) | 1611 | 1597 | if (channel->nservers == -1) { | 1612 | 1598 | union res_sockaddr_union addr[MAXNS]; | 1613 | 1599 | int nscount = res_getservers(&res, addr, MAXNS); | 1614 | | - for (int i = 0; i < nscount; ++i) { | | 1600 | + int i; | | 1601 | + for (i = 0; i < nscount; ++i) { | 1615 | 1602 | char str[INET6_ADDRSTRLEN]; | 1616 | 1603 | int config_status; | 1617 | 1604 | sa_family_t family = addr[i].sin.sin_family; | @@ -1639,8 +1626,9 @@ static int init_by_resolv_conf(ares_channel channel) | 1639 | 1626 | if (!channel->domains) { | 1640 | 1627 | status = ARES_ENOMEM; | 1641 | 1628 | } else { | | 1629 | + int i; | 1642 | 1630 | channel->ndomains = entries; | 1643 | | - for (int i = 0; i < channel->ndomains; ++i) { | | 1631 | + for (i = 0; i < channel->ndomains; ++i) { | 1644 | 1632 | channel->domains[i] = ares_strdup(res.dnsrch[i]); | 1645 | 1633 | if (!channel->domains[i]) | 1646 | 1634 | status = ARES_ENOMEM; | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_parse_caa_reply.c +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -140,7 +140,7 @@ ares_parse_caa_reply (const unsigned char *abuf, int alen, | 140 | 140 | status = ARES_EBADRESP; | 141 | 141 | break; | 142 | 142 | } | 143 | | - caa_curr->critical = (int)*strptr++; | | 143 | + caa_curr->critical = (int)*strptr++; | 144 | 144 | caa_curr->plength = (int)*strptr++; | 145 | 145 | if (caa_curr->plength <= 0 || (int)caa_curr->plength >= rr_len - 2) | 146 | 146 | { | |
Collapse file Copy file name to clipboardExpand all lines: deps/cares/src/ares_parse_soa_reply.c +6-3Lines changed: 6 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,13 +62,16 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, | 62 | 62 | return ARES_EBADRESP; | 63 | 63 | if (ancount == 0) | 64 | 64 | return ARES_EBADRESP; | 65 | | - | | 65 | + | 66 | 66 | aptr = abuf + HFIXEDSZ; | 67 | 67 |
| 68 | 68 | /* query name */ | 69 | 69 | status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len); | 70 | 70 | if (status != ARES_SUCCESS) | 71 | 71 | goto failed_stat; | | 72 | + | | 73 | + if (alen <= len + HFIXEDSZ + 1) | | 74 | + goto failed; | 72 | 75 | aptr += len; | 73 | 76 |
| 74 | 77 | qclass = DNS_QUESTION_TYPE(aptr); | @@ -161,9 +164,9 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, | 161 | 164 | return ARES_SUCCESS; | 162 | 165 | } | 163 | 166 | aptr += rr_len; | 164 | | - | | 167 | + | 165 | 168 | ares_free(rr_name); | 166 | | - | | 169 | + | 167 | 170 | if (aptr > abuf + alen) | 168 | 171 | goto failed_stat; | 169 | 172 | } | |
|