From: Florian Weimer Date: Fri, 2 Jun 2017 14:35:13 +0000 (+0200) Subject: getaddrinfo: Fix localplt failure involving strdup X-Git-Tag: glibc-2.26~437 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6257fcfd58479f6b7ae0fdde045b9ff144d543da;p=thirdparty%2Fglibc.git getaddrinfo: Fix localplt failure involving strdup --- diff --git a/ChangeLog b/ChangeLog index 2b0a09b1663..f37370c60c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-06-02 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gethosts): Eliminate another + strdupa. + (getcanonname): Use __strdup instead of strdup. + 2017-06-02 Adhemerval Zanella * misc/Makefile (CFLAGS-preadv2.c): New rule. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index d92db701213..a8b5bb541e1 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -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