mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
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.
This commit is contained in:
parent
0ef1284028
commit
a79fccef13
@ -40,7 +40,7 @@ _hurd_change_directory_port_from_name (struct hurd_port *portcell,
|
||||
lookup = name;
|
||||
else
|
||||
{
|
||||
char *n = alloca (len + 2);
|
||||
char *n = alloca (len + 3);
|
||||
memcpy (n, name, len);
|
||||
n[len] = '/';
|
||||
n[len + 1] = '.';
|
||||
|
@ -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] = '.';
|
||||
|
Loading…
Reference in New Issue
Block a user