about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-13 01:49:55 +0000
committerRoland McGrath <roland@gnu.org>2002-05-13 01:49:55 +0000
commita79fccef132e1590493f78035cf90ededf71771f (patch)
tree35d3c43fda74a5c0263479f7f21843132dd7159c /sysdeps
parent0ef1284028e33b7d84c5a646c1927c7f405ac348 (diff)
downloadglibc-a79fccef132e1590493f78035cf90ededf71771f.tar.gz
glibc-a79fccef132e1590493f78035cf90ededf71771f.tar.xz
glibc-a79fccef132e1590493f78035cf90ededf71771f.zip
2002-05-13 Marcus Brinkmann <marcus@gnu.org>
        * hurd/hurdchdir.c (_hurd_change_directory_port_from_name):
        Allocate three, not two, more than LEN when appending '/.'.
        * sysdeps/mach/hurd/chroot.c (chroot): Likewise.  Don't check
        if NAME ends with '/.' if it is shorter than 2 chars.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/chroot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/chroot.c b/sysdeps/mach/hurd/chroot.c
index 83f11bd17e..fde0164713 100644
--- a/sysdeps/mach/hurd/chroot.c
+++ b/sysdeps/mach/hurd/chroot.c
@@ -36,11 +36,11 @@ chroot (const char *path)
   /* Append trailing "/." to directory name to force ENOTDIR if it's not a
      directory and EACCES if we don't have search permission.  */
   len = strlen (path);
-  if (path[len - 2] == '/' && path[len - 1] == '.')
+  if (len >= 2 && path[len - 2] == '/' && path[len - 1] == '.')
     lookup = path;
   else
     {
-      char *n = alloca (len + 2);
+      char *n = alloca (len + 3);
       memcpy (n, path, len);
       n[len] = '/';
       n[len + 1] = '.';