summaryrefslogtreecommitdiff
path: root/nis/nis_subr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-10-25 19:13:42 +0000
committerJakub Jelinek <jakub@redhat.com>2006-10-25 19:13:42 +0000
commit21cb7ca55c2fdd7e9aca6c7a80ae0d7ca4f6c7da (patch)
tree9bce2d28d077684abe0904fdfb3974e06ceb29f6 /nis/nis_subr.c
parent16d1b47b4f3f9ae13535ea7a2c02bd207c069d5c (diff)
Updated to fedora-glibc-20061025T1857cvs/fedora-glibc-2_5_90-1
Diffstat (limited to 'nis/nis_subr.c')
-rw-r--r--nis/nis_subr.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 40c9270501..258479c857 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -178,7 +178,7 @@ nis_getnames (const_nis_name name)
}
/* Get the search path, where we have to search "name" */
- path = getenv ("NIS_PATH");
+ path = __secure_getenv ("NIS_PATH");
if (path == NULL)
path = strdupa ("$");
else
@@ -251,13 +251,16 @@ nis_getnames (const_nis_name name)
{
char *p;
- tmp = malloc (cplen + name_len + 2);
+ tmp = malloc (cplen + name_len + 3);
if (__builtin_expect (tmp == NULL, 0))
goto free_null;
- p = __stpcpy (tmp, name);
+ p = __mempcpy (tmp, name, name_len);
*p++ = '.';
- memcpy (p, cp, cplen + 1);
+ p = __mempcpy (p, cp, cplen);
+ if (p[-1] != '.')
+ *p++ = '.';
+ *p = '\0';
}
if (pos >= count)
@@ -275,6 +278,13 @@ nis_getnames (const_nis_name name)
cp = __strtok_r (NULL, ":", &saveptr);
}
+ if (pos == 0
+ && __asprintf (&getnames[pos++], "%s%s%s%s",
+ name, name[name_len - 1] == '.' ? "" : ".",
+ local_domain,
+ local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+ goto free_null;
+
getnames[pos] = NULL;
return getnames;