[uClibc] gethostbyname_r not properly creating hostent result when using dns ?

Mike Frysinger vapier at gentoo.org
Mon Aug 9 14:17:53 UTC 2004


On Monday 02 August 2004 08:44 am, Mike Frysinger wrote:
> the gethostbyname_r() call itself is not segfaulting, but the memory
> returned in the h_aliases array seems to be wrong ...

was playing around with the source today and eventually the obvious answer hit 
me ... while read_etc_hosts_r() generatings an array of strings fo h_aliases 
and populates it, the dns path does not :)

find attached a patch that'll actually generate the h_aliases list in the 
normal dns code path ... i used the etc_hosts_r() code as a template for some 
of it ...

note that this is just a simple fix ... it fills the alias list with just the 
hostname gethostbyname_r was passed ... the proper fix i think would be to 
parse the dns packet down in __dns_lookup() and pass the info back via the 
resolv_answer struct ...
but this fix is better than the current state of things ... that is, h_aliases 
currently is never initailized in the dns code path :)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resolve.patch
Type: text/x-diff
Size: 1192 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20040809/cd71aedf/attachment.bin 


More information about the uClibc mailing list