summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjl <hjl>2000-07-05 00:03:40 +0000
committerhjl <hjl>2000-07-05 00:03:40 +0000
commit282284fac3c3fe20187f892e3ce15ac319c8acb7 (patch)
tree16867c381edb5e7515fb7d7a8669d23b2a4fb902
parentffcddda0b11ca445e98f9a58a1e3555bdaec2d7e (diff)
downloadnfs-utils-282284fac3c3fe20187f892e3ce15ac319c8acb7.tar.gz
nfs-utils-282284fac3c3fe20187f892e3ce15ac319c8acb7.tar.xz
nfs-utils-282284fac3c3fe20187f892e3ce15ac319c8acb7.zip
2000-07-04 Neil Brown <neilb@cse.unsw.edu.au>
* support/export/hostname.c (hostent_dup): Handle the NULL h_aliases field.
-rw-r--r--ChangeLog5
-rw-r--r--support/export/hostname.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8501856..2c54ed0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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]);