diff options
| author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2022-01-24 21:36:41 +0530 |
|---|---|---|
| committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2022-01-24 21:44:54 +0530 |
| commit | d084965adc7baa8ea804427cccf973cea556d697 (patch) | |
| tree | dc6810eaf5035d648bd3d021177044db174b1eed | |
| parent | 472e799a5f2102bc0c3206dbd5a801765fceb39c (diff) | |
| download | glibc-d084965adc7baa8ea804427cccf973cea556d697.tar.xz glibc-d084965adc7baa8ea804427cccf973cea556d697.zip | |
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 84d2d0fe20bdf94feed82b21b4d7d136db471f03)
| -rw-r--r-- | stdlib/canonicalize.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c index 7a23a51b3a..e2d4244fc7 100644 --- a/stdlib/canonicalize.c +++ b/stdlib/canonicalize.c @@ -404,7 +404,7 @@ error: { if (dest - rname <= get_path_max ()) rname = strcpy (resolved, rname); - else + else if (!failed) { failed = true; __set_errno (ENAMETOOLONG); |
