deps: cherry-pick 0d252eb from upstream c-ares

Original commit message:

  If there are more ttls returned than the maximum provided by the requestor, then
  the *naddrttls response would be larger than the actual number of elements in
  the addrttls array.

  This bug could lead to invalid memory accesses in applications using c-ares.

  This behavior appeared to break with PR https://github.com/c-ares/c-ares/pull/257

  Fixes: https://github.com/c-ares/c-ares/issues/371
  Reported By: Momtchil Momtchev (@mmomtchev)
  Fix By: Brad House (@bradh352)

Refs: https://github.com/nodejs/node/issues/36063

Signed-off-by: Michael Dawson <mdawson@devrus.com>

CVE-ID: CVE-2020-8277
PR-URL: https://github.com/nodejs-private/node-private/pull/231
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
This commit is contained in:
Michael Dawson authored and Michaël Zasso committed 2020-11-15 08:31:48 +01:00
1 parent df211208c0
commit 2a44836eeb
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -197,7 +197,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
if (naddrttls)
{
*naddrttls = naddrs;
/* Truncated to at most *naddrttls entries */
*naddrttls = (naddrs > *naddrttls)?*naddrttls:naddrs;
}
ares__freeaddrinfo_cnames(ai.cnames);
+2 -1
View File
@@ -200,7 +200,8 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
if (naddrttls)
{
*naddrttls = naddrs;
/* Truncated to at most *naddrttls entries */
*naddrttls = (naddrs > *naddrttls)?*naddrttls:naddrs;
}
ares__freeaddrinfo_cnames(ai.cnames);