about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-06-02 16:35:13 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-06-02 16:35:13 +0200
commit6257fcfd58479f6b7ae0fdde045b9ff144d543da (patch)
tree3c0814cea66c3a2e09948ed411f24dd116495fcf
parentca4b396ebebf8869e199268edbb5808bb5488c50 (diff)
downloadglibc-6257fcfd58479f6b7ae0fdde045b9ff144d543da.tar.gz
glibc-6257fcfd58479f6b7ae0fdde045b9ff144d543da.tar.xz
glibc-6257fcfd58479f6b7ae0fdde045b9ff144d543da.zip
getaddrinfo: Fix localplt failure involving strdup
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/posix/getaddrinfo.c15
2 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b0a09b166..f37370c60c 100644
--- 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.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index d92db70121..a8b5bb541e 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