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

Paul Guyot pguyot@REDACTED
Mon Oct 6 17:10:54 CEST 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_ei_resolve.diff
Type: application/octet-stream
Size: 1531 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081006/e97b2b6f/attachment.obj>


More information about the erlang-bugs mailing list