mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-11 22:00:08 +00:00
realpath: Avoid overwriting preexisting error (CVE-2021-3998)
Set errno and failure for paths that are too long only if no other error
occurred earlier.
Related: BZ #28770
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit 84d2d0fe20
)
This commit is contained in:
parent
472e799a5f
commit
d084965adc
@ -404,7 +404,7 @@ error:
|
|||||||
{
|
{
|
||||||
if (dest - rname <= get_path_max ())
|
if (dest - rname <= get_path_max ())
|
||||||
rname = strcpy (resolved, rname);
|
rname = strcpy (resolved, rname);
|
||||||
else
|
else if (!failed)
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
__set_errno (ENAMETOOLONG);
|
__set_errno (ENAMETOOLONG);
|
||||||
|
Loading…
Reference in New Issue
Block a user