(canonicalize): Zero terminate path to copy on error.

This commit is contained in:
Ulrich Drepper 2000-02-11 18:04:18 +00:00
parent 8c201918bc
commit 8aa2f31c9a

View File

@ -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;