mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-14 23:30:06 +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 (name[0] != '/')
|
||||||
{
|
{
|
||||||
if (!__getcwd (rpath, path_max))
|
if (!__getcwd (rpath, path_max))
|
||||||
|
{
|
||||||
|
rpath[0] = '\0';
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
dest = strchr (rpath, '\0');
|
dest = strchr (rpath, '\0');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -122,6 +125,9 @@ canonicalize (const char *name, char *resolved)
|
|||||||
if (resolved)
|
if (resolved)
|
||||||
{
|
{
|
||||||
__set_errno (ENAMETOOLONG);
|
__set_errno (ENAMETOOLONG);
|
||||||
|
if (dest > rpath + 1)
|
||||||
|
dest--;
|
||||||
|
*dest = '\0';
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
new_size = rpath_limit - rpath;
|
new_size = rpath_limit - rpath;
|
||||||
|
Loading…
Reference in New Issue
Block a user