Commit 32b75d1b authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- Phil Blundell added the internal function ares__expand_name_for_response()

  that is now used by the ares_parse_*_reply() functions instead of the
  ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
  the name expansion fails as in responses that really isn't expected.
parent f7e3bd28
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
  Changelog for the c-ares project

* January 11 2008 (Daniel Stenberg)
- Phil Blundell added the internal function ares__expand_name_for_response()
  that is now used by the ares_parse_*_reply() functions instead of the
  ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
  the name expansion fails as in responses that really isn't expected.

Version 1.6.0 (Dec 9, 2008)

* December 9 2008 (Gisle Vanem)

  Fixes for Win32 targets using the Watt-32 tcp/ip stack.
+3 −2
Original line number Diff line number Diff line
@@ -6,10 +6,11 @@ Changed:

Fixed:

 o 
 o ares_parse_*_reply() functions now return ARES_EBADRESP instead of
   ARES_EBADNAME if the name in the response failed to decode

Thanks go to these friendly people for their efforts and contributions:

 
 Phil Blundell

Have fun!
+11 −0
Original line number Diff line number Diff line
@@ -177,3 +177,14 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
   */
  return (n) ? n - 1 : n;
}

/* Like ares_expand_name but returns EBADRESP in case of invalid input. */
int ares__expand_name_for_response(const unsigned char *encoded,
                                   const unsigned char *abuf, int alen,
                                   char **s, long *enclen)
{
  int status = ares_expand_name(encoded, abuf, alen, s, enclen);
  if (status == ARES_EBADNAME)
    status = ARES_EBADRESP;
  return status;
}
+7 −5
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,

  /* Expand the name from the question, and skip past the question. */
  aptr = abuf + HFIXEDSZ;
  status = ares_expand_name(aptr, abuf, alen, &hostname, &len);
  status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len);
  if (status != ARES_SUCCESS)
    return status;
  if (aptr + len + QFIXEDSZ > abuf + alen)
@@ -95,7 +95,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,

  if (host)
    {
      /* Allocate addresses and aliases; ancount gives an upper bound for both. */
      /* Allocate addresses and aliases; ancount gives an upper bound for
         both. */
      addrs = malloc(ancount * sizeof(struct in_addr));
      if (!addrs)
        {
@@ -123,7 +124,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
  for (i = 0; i < (int)ancount; i++)
    {
      /* Decode the RR up to the data field. */
      status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
      status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
      if (status != ARES_SUCCESS)
        break;
      aptr += len;
@@ -176,7 +177,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
          naliases++;

          /* Decode the RR data and replace the hostname with it. */
          status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
          status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
                                                  &len);
          if (status != ARES_SUCCESS)
            break;
          free(hostname);
+4 −3
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,

  /* Expand the name from the question, and skip past the question. */
  aptr = abuf + HFIXEDSZ;
  status = ares_expand_name(aptr, abuf, alen, &hostname, &len);
  status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len);
  if (status != ARES_SUCCESS)
    return status;
  if (aptr + len + QFIXEDSZ > abuf + alen)
@@ -123,7 +123,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
  for (i = 0; i < (int)ancount; i++)
    {
      /* Decode the RR up to the data field. */
      status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
      status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
      if (status != ARES_SUCCESS)
        break;
      aptr += len;
@@ -176,7 +176,8 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
          naliases++;

          /* Decode the RR data and replace the hostname with it. */
          status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
          status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
                                                  &len);
          if (status != ARES_SUCCESS)
            break;
          free(hostname);
Loading