From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 128EB3858407; Fri, 21 Jan 2022 17:45:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 128EB3858407 From: "siddhesh at sourceware dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/28770] Unexpected return value from realpath() for too long results (CVE-2021-3998) Date: Fri, 21 Jan 2022 17:45:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.35 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at sourceware dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: siddhesh at sourceware dot org X-Bugzilla-Target-Milestone: 2.35 X-Bugzilla-Flags: security+ X-Bugzilla-Changed-Fields: target_milestone resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2022 17:45:09 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28770 Siddhesh Poyarekar changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.35 Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #1 from Siddhesh Poyarekar --- Fixed on trunk: commit ee8d5e33adb284601c00c94687bc907e10aec9bb Author: Siddhesh Poyarekar Date: Thu Jan 13 11:28:36 2022 +0530 realpath: Set errno to ENAMETOOLONG for result larger than PATH_MAX [BZ #28770] realpath returns an allocated string when the result exceeds PATH_MAX, which is unexpected when its second argument is not NULL. This results in the second argument (resolved) being uninitialized and also results in a memory leak since the caller expects resolved to be the same as the returned value. Return NULL and set errno to ENAMETOOLONG if the result exceeds PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998. Reviewed-by: Adhemerval Zanella Signed-off-by: Siddhesh Poyarekar --=20 You are receiving this mail because: You are on the CC list for the bug.=