From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 78ECB3851503; Thu, 27 Oct 2022 13:48:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78ECB3851503 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666878539; bh=Xpewe3MqOURDFx2qsF68M8kRxuoEhKFnr16O1U6o5tg=; h=From:To:Subject:Date:From; b=Pr70uKu/soGzE2M9Ico8ekbtV0+zn+kHaaPS1p7/RvqSXO4YkL9eGtV6mg+cLf8ha euY/P/u9VxK/DkPryjqCkr8GZP8uDTrE2Wj78Q5n5Cr/f8VPXyjSm2cqOqbXyGpUbn flxtE2KMPMh6s4n4XtWC60W6cjCx7gC8+QDHA1sI= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] Fix invalid pointer dereference in wcpcpy_chk X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: 36cb53c9c848cba09e609f136689943e445d6d36 X-Git-Newrev: 4c22e2fa7df607356f4e3b261277fd77f8de41aa Message-Id: <20221027134859.78ECB3851503@sourceware.org> Date: Thu, 27 Oct 2022 13:48:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4c22e2fa7df607356f4e3b261277fd77f8de41aa commit 4c22e2fa7df607356f4e3b261277fd77f8de41aa Author: Szabolcs Nagy Date: Tue Jun 21 15:57:48 2022 +0100 Fix invalid pointer dereference in wcpcpy_chk The src pointer is const and points to a different object, so accessing dest via src is invalid. Diff: --- debug/wcpcpy_chk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c index bc2be43c3e..d44fb479d0 100644 --- a/debug/wcpcpy_chk.c +++ b/debug/wcpcpy_chk.c @@ -28,13 +28,12 @@ __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen) { wchar_t *wcp = (wchar_t *) dest - 1; wint_t c; - const ptrdiff_t off = src - dest + 1; do { if (__glibc_unlikely (destlen-- == 0)) __chk_fail (); - c = wcp[off]; + c = *src++; *++wcp = c; } while (c != L'\0');