diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | support/export/hostname.c | 6 |
2 files changed, 8 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2000-07-04 Neil Brown <neilb@cse.unsw.edu.au> + + * support/export/hostname.c (hostent_dup): Handle the NULL + h_aliases field. + 2000-07-03 H.J. Lu <hjl@lucon.org> * README: Update the util-linux requirement. diff --git a/support/export/hostname.c b/support/export/hostname.c index a37d4de..299fe99 100644 --- a/support/export/hostname.c +++ b/support/export/hostname.c @@ -104,7 +104,7 @@ hostent_dup (struct hostent *hp) char **sp; struct hostent *cp; - for (sp = hp->h_aliases; *sp; sp++) + for (sp = hp->h_aliases; sp && *sp; sp++) { num_aliases++; len_aliases += align (strlen (*sp) + 1, ALIGNMENT) @@ -130,14 +130,14 @@ hostent_dup (struct hostent *hp) cp->h_aliases = (char **) &(((char *) cp) [pos]); pos += num_aliases * sizeof (char *); for (sp = hp->h_aliases, i = 0; i < num_aliases; i++, sp++) - if (*sp) + if (sp && *sp) { cp->h_aliases [i] = (char *) &(((char *) cp) [pos]); strcpy (cp->h_aliases [i], *sp); pos += align (strlen (*sp) + 1, ALIGNMENT); } else - cp->h_aliases [i] = *sp; + cp->h_aliases [i] = NULL; pos = len_ent + len_name + len_aliases; cp->h_addr_list = (char **) &(((char *) cp) [pos]); |