]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
getaddrinfo: Fix localplt failure involving strdup
authorFlorian Weimer <fweimer@redhat.com>
Fri, 2 Jun 2017 14:35:13 +0000 (16:35 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 2 Jun 2017 14:35:13 +0000 (16:35 +0200)
ChangeLog
sysdeps/posix/getaddrinfo.c

index 2b0a09b166364d083526df50ebf228a0b8f62d20..f37370c60c1a1ca3e724d68e36e984e56bca88ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-02  Florian Weimer  <fweimer@redhat.com>
+
+       * sysdeps/posix/getaddrinfo.c (gethosts): Eliminate another
+       strdupa.
+       (getcanonname): Use __strdup instead of strdup.
+
 2017-06-02  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        * misc/Makefile (CFLAGS-preadv2.c): New rule.
index d92db7012131eeac609262f0cc712a2aeecc1659..a8b5bb541e1411502ded4d8539d9d78f8d3f7f23 100644 (file)
@@ -286,9 +286,16 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
        }                                                                     \
       *pat = addrmem;                                                        \
                                                                              \
-      if (localcanon !=        NULL && canon == NULL)                                \
-       canon = strdupa (localcanon);                                         \
-                                                                             \
+      if (localcanon != NULL && canon == NULL)                               \
+       {                                                                     \
+         canonbuf = __strdup (localcanon);                                   \
+         if (canonbuf == NULL)                                               \
+           {                                                                 \
+             result = -EAI_SYSTEM;                                           \
+             goto free_and_return;                                           \
+           }                                                                 \
+         canon = canonbuf;                                                   \
+       }                                                                     \
       if (_family == AF_INET6 && *pat != NULL)                               \
        got_ipv6 = true;                                                      \
     }                                                                        \
@@ -330,7 +337,7 @@ getcanonname (service_user *nip, struct gaih_addrtuple *at, const char *name)
           string.  */
        s = (char *) name;
     }
-  return strdup (name);
+  return __strdup (name);
 }
 
 static int