[2.25 COMMITTED] getaddrinfo: Fix localplt failure involving strdup
Florian Weimer
fweimer@redhat.com
Mon Jan 1 00:00:00 GMT 2018
(cherry picked from commit 6257fcfd58479f6b7ae0fdde045b9ff144d543da)
2017-06-02 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gethosts): Eliminate another
strdupa.
(getcanonname): Use __strdup instead of strdup.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 4ca1641756..37e84c1eb1 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
More information about the Libc-stable
mailing list