aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd')
-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] = '.';