]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
getaddrinfo: Merge IPv6 addresses and IPv4 addresses [BZ #21295]
authorDmitry Bilunov <kmeaw@kmeaw.com>
Thu, 4 Jan 2018 10:33:53 +0000 (11:33 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 4 Jan 2018 10:45:26 +0000 (11:45 +0100)
(cherry picked from commit 5cf88a83f27b0cd2d5a83511930e40d716c939eb)

ChangeLog
NEWS
sysdeps/posix/getaddrinfo.c

index 473f5fddde353b681d6e0df2c64ff32b838f4c4c..1f4b1577e950c57977d31359aad31cd394086e4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-24  Dmitry Bilunov  <kmeaw@kmeaw.com>
+
+       [BZ #21295]
+       * sysdeps/posix/getaddrinfo.c (convert_hostent_to_gaih_addrtuple):
+       Append addresses at the end of the list.
+
 2017-05-11  Florian Weimer  <fweimer@redhat.com>
 
        * support/support_format_addrinfo.c (format_ai_flags_1): Renamed
diff --git a/NEWS b/NEWS
index 38bb008b0636a5d81ba8d336aac5ddb215d69822..6bb7dfcf4287b1967b9daca5660d1c9f051ca9ed 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ The following bugs are resolved with this release:
   [21242] assert: Suppress pedantic warning caused by statement expression
   [21265] x86-64: Use fxsave/xsave/xsavec in _dl_runtime_resolve
   [21289] Fix symbol redirect for fts_set
+  [21295] getaddrinfo: Merge IPv6 addresses and IPv4 addresses
   [21298] rwlock can deadlock on frequent reader/writer phase switching
   [21359] resolv: Support an exactly sized buffer in ns_name_pack
   [21386] Assertion in fork for distinct parent PID is incorrect
index 611abc2338ae34d0bd4baaf3e20deae2efdeea75..ceb1e0b024802839c0bff839c4588a40b9e652e8 100644 (file)
@@ -190,16 +190,16 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
 
 /* Convert struct hostent to a list of struct gaih_addrtuple objects.
    h_name is not copied, and the struct hostent object must not be
-   deallocated prematurely.  *RESULT must be NULL or a pointer to an
-   object allocated using malloc, which is freed.  */
+   deallocated prematurely.  *RESULT must be NULL or a pointer to a
+   linked-list.  The new addresses are appended at the end.  */
 static bool
 convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
                                   int family,
                                   struct hostent *h,
                                   struct gaih_addrtuple **result)
 {
-  free (*result);
-  *result = NULL;
+  while (*result)
+    result = &(*result)->next;
 
   /* Count the number of addresses in h->h_addr_list.  */
   size_t count = 0;