From: hjl Date: Wed, 5 Jul 2000 00:03:40 +0000 (+0000) Subject: 2000-07-04 Neil Brown X-Git-Tag: nfs-utils-0-1-9-1~2 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=282284fac3c3fe20187f892e3ce15ac319c8acb7;p=nfs-utils.git 2000-07-04 Neil Brown * support/export/hostname.c (hostent_dup): Handle the NULL h_aliases field. --- diff --git a/ChangeLog b/ChangeLog index 8501856..2c54ed0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-07-04 Neil Brown + + * support/export/hostname.c (hostent_dup): Handle the NULL + h_aliases field. + 2000-07-03 H.J. Lu * 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]);