[erlang-bugs] Bug in ei_resolve.c/copy_hostent

Björn-Egil Dahlberg <>
Fri Oct 10 14:56:02 CEST 2008

Hi Paul,

Thank you for pointing this out.
I have added this item to my ToDo-list and I have made a ticket of it.

It is my intention to have this corrected in R12B-5.


Paul Guyot wrote:
> Hello,
> There is a very bad bug in ei_resolve.c's copy_hostent. The function 
> modifies the source hostent structure provided by gethost* functions, 
> and in particular h_aliases and h_addr_list, while it shouldn't. On 
> MacOS X 10.4, this yields to a heap corruption. One can arguably blame 
> MacOS X for this bug (which might be fixed on 10.5), but yet I believe 
> the fields should be copied for safety. The attached patch fixes the 
> problem and declares the source hostent const to enforce the check by 
> the compiler.
> Regards,
> Paul
> ------------------------------------------------------------------------
> _______________________________________________
> erlang-bugs mailing list
> http://www.erlang.org/mailman/listinfo/erlang-bugs

More information about the erlang-bugs mailing list