This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] getaddrinfo: Always allocate canonical name on the heap

On 06/02/2017 11:26 PM, Joseph Myers wrote:
> I'm still seeing a localplt failure for strdup even after commit 
> 6257fcfd58479f6b7ae0fdde045b9ff144d543da.
> (The strdup@plt reference is from gaih_inet.constprop.6, at least on 
> x86_64.  It seems there is one plain strdup reference in 
> sysdeps/posix/getaddrinfo.c.)

Right.  I figured out why I wasn't seeing this (localplt doesn't check
for local function relocation relocations in general, only PLT entries,
so -z blinds it), and verified that the attached patch fixes the
remaining failure.  Committed.

getaddrinfo: Eliminate another strdup call

2017-06-03  Florian Weimer  <>

	* sysdeps/posix/getaddrinfo.c (gaih_inet): Call __strdup instead
	of strdup.

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index a8b5bb5..a8bdd9a 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -732,7 +732,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			(*pat)->name = NULL;
 		      else if (canonbuf == NULL)
-			  canonbuf = strdup (air->canon);
+			  canonbuf = __strdup (air->canon);
 			  if (canonbuf == NULL)
 			      result = -EAI_MEMORY;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]