From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 551F73852C56; Wed, 23 Nov 2022 14:46:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 551F73852C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669214804; bh=hqqBqX77S9WknKIocQLljdnhwClZufK/4kPQ68mteuI=; h=From:To:Subject:Date:From; b=KAKxqhRoRJ4NgPefhCg0mV9zHRHgfxnulFmlusl/NrTWEDZ9s+Y1N2KtUOJUtxmPF zZHsrA2NNr7u2fDhw0uHdMIA08Jr0vK77LNZLVIDKlv11387384flnnniRtGfSuFbu 1y9qBEdDBWFuwDA60tOyoD0+3oVrFKKi/7u3vsMM= 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 use after realloc in localealias X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: c0ba8ad1fe451f2849ce7c6fdb477c94471d5d25 X-Git-Newrev: cd345f5c03e504faca874e1da74bc966a379cedb Message-Id: <20221123144644.551F73852C56@sourceware.org> Date: Wed, 23 Nov 2022 14:46:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cd345f5c03e504faca874e1da74bc966a379cedb commit cd345f5c03e504faca874e1da74bc966a379cedb Author: Szabolcs Nagy Date: Fri Mar 18 06:55:31 2022 +0000 cheri: fix invalid pointer use after realloc in localealias This code updates pointers to a reallocated buffer to point to the new buffer. It is not conforming (does arithmetics with freed pointers), but it also creates invalid capabilities because the provenance is derived from the original freed pointers instead of the new buffer. Change the arithmetics so provenance is derived from the new buffer. The conformance issue is not fixed. Diff: --- intl/localealias.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intl/localealias.c b/intl/localealias.c index b36092363a..0401f35f9d 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -340,8 +340,10 @@ read_alias_file (const char *fname, int fname_len) for (i = 0; i < nmap; i++) { - map[i].alias += new_pool - string_space; - map[i].value += new_pool - string_space; + map[i].alias = new_pool + + (map[i].alias - string_space); + map[i].value = new_pool + + (map[i].value - string_space); } }