diff options
Diffstat (limited to 'otherlibs/unix/gethost.c')
-rw-r--r-- | otherlibs/unix/gethost.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c index 86d2f0fdb..18d3be0a9 100644 --- a/otherlibs/unix/gethost.c +++ b/otherlibs/unix/gethost.c @@ -62,7 +62,12 @@ static value alloc_host_entry(struct hostent *entry) Begin_roots4 (name, aliases, addr_list, adr); name = copy_string((char *)(entry->h_name)); - aliases = copy_string_array((const char**)entry->h_aliases); + /* PR#4043: protect against buggy implementations of gethostbyname() + that return a NULL pointer in h_aliases */ + if (entry->h_aliases) + aliases = copy_string_array((const char**)entry->h_aliases); + else + aliases = Atom(0); entry_h_length = entry->h_length; #ifdef h_addr addr_list = alloc_array(alloc_one_addr, (const char**)entry->h_addr_list); |