From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 37171385153A; Wed, 26 Oct 2022 15:11:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37171385153A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666797073; bh=rJSDjj8Z1avhLBDy5T5GHOa0ZeoOFw84fjRWTjnhHgE=; h=From:To:Subject:Date:From; b=CHva9a9uRCFKMV20NwB98WatU0826KEhG/zI+pgIJjHG8aKHukLky/McMKdZFSV1z YiZjJgQO0cHe9Kmjs0pzDqbJSQ2gZZdn0i1QpDA/Qx7SFbL7YyQ+98KA16Uk76cIt3 tdn9OjIMGcRg9IMLlnA5+hmbYe71SaR3i1VmuNIY= 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] cheri: Fix invalid pointer deref in wcpcpy_chk X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: 1f6055dcb036abdb3db0ea622e08c60966811127 X-Git-Newrev: 876cc51c8e936542a21f6da04f4aed3793189599 Message-Id: <20221026151113.37171385153A@sourceware.org> Date: Wed, 26 Oct 2022 15:11:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=876cc51c8e936542a21f6da04f4aed3793189599 commit 876cc51c8e936542a21f6da04f4aed3793189599 Author: Szabolcs Nagy Date: Tue Jun 21 15:57:48 2022 +0100 cheri: Fix invalid pointer deref in wcpcpy_chk Accessing src via the dest pointer 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');