summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/gethost.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2006-09-20 11:14:37 +0000
committerDamien Doligez <damien.doligez-inria.fr>2006-09-20 11:14:37 +0000
commitfbea66a95e1d890799b6b573bcd0131558b9ba92 (patch)
tree8bfb6bd4b2688d06b2c9934a2b026797b5e91733 /otherlibs/unix/gethost.c
parent403f1e1a34fb6b62072c9e89b84ac2aad3e37f9e (diff)
fusion des changements 3.09.2 -> 3.09.3
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7619 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/gethost.c')
-rw-r--r--otherlibs/unix/gethost.c7
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);