]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* nis/nis_subr.c (nis_getnames): Add trailing dot to NIS_PATH
authorUlrich Drepper <drepper@redhat.com>
Wed, 11 Oct 2006 01:28:34 +0000 (01:28 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 11 Oct 2006 01:28:34 +0000 (01:28 +0000)
components which lack them.

* nis/nis_subr.c (nis_getnames): Make sure that we always return
at least one entry consisting of the parameter concatenated with
the domain.

ChangeLog
nis/nis_subr.c

index 7279f5fe7701df0d6bcbf024a074371dcde057fe..4355bf59c68e49593fde750c5987d7afbf99b6fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-10  Ulrich Drepper  <drepper@redhat.com>
+
+       * nis/nis_subr.c (nis_getnames): Add trailing dot to NIS_PATH
+       components which lack them.
+
+       * nis/nis_subr.c (nis_getnames): Make sure that we always return
+       at least one entry consisting of the parameter concatenated with
+       the domain.
+
 2006-10-10  Roland McGrath  <roland@frob.com>
 
        * sysdeps/mach/hurd/utimes.c: Use a union to avoid an improper cast.
index 93e34f13cbe1123268e72e193fecfcf54d5a5b41..c68189e541b0c9a23035b69cb6fa870202fcc76b 100644 (file)
@@ -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)