mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-14 07:10:05 +00:00
(canonicalize): Zero terminate path to copy on error.
This commit is contained in:
parent
8c201918bc
commit
8aa2f31c9a
@ -76,7 +76,10 @@ canonicalize (const char *name, char *resolved)
|
||||
if (name[0] != '/')
|
||||
{
|
||||
if (!__getcwd (rpath, path_max))
|
||||
goto error;
|
||||
{
|
||||
rpath[0] = '\0';
|
||||
goto error;
|
||||
}
|
||||
dest = strchr (rpath, '\0');
|
||||
}
|
||||
else
|
||||
@ -122,6 +125,9 @@ canonicalize (const char *name, char *resolved)
|
||||
if (resolved)
|
||||
{
|
||||
__set_errno (ENAMETOOLONG);
|
||||
if (dest > rpath + 1)
|
||||
dest--;
|
||||
*dest = '\0';
|
||||
goto error;
|
||||
}
|
||||
new_size = rpath_limit - rpath;
|
||||
|
Loading…
Reference in New Issue
Block a user