public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.33/master] realpath: Avoid overwriting preexisting error (CVE-2021-3998)
@ 2022-01-24 22:49 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2022-01-24 22:49 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=41980af2d77ecaef34ef5470dc76f6137279e47f

commit 41980af2d77ecaef34ef5470dc76f6137279e47f
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jan 24 21:36:41 2022 +0530

    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)

Diff:
---
 stdlib/canonicalize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-24 22:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 22:49 [glibc/release/2.33/master] realpath: Avoid overwriting preexisting error (CVE-2021-3998) Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).