From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25953 invoked from network); 13 Mar 2022 00:28:57 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 13 Mar 2022 00:28:57 -0000 Received: (qmail 17774 invoked by uid 550); 13 Mar 2022 00:28:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 17742 invoked from network); 13 Mar 2022 00:28:53 -0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilposton.com; s=key1; t=1647131322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OWTo/5+P2t0QjfsLI5K3bGlHpjaDi4T+rKjk698UBtM=; b=lPYTCAA0q5fh+UwYTyKhkTrim/2WTJklQsEmifiiWWfy++mqur+j+vgc5YI5e+CpZycIO2 ZAmjWux3skdPqC4j4Ik0uWAI3YtYrZU1S3mi4VPTymsHjaayHGMApz8kkuISbqzw269Tqf oHV2yieW8/Q8PS0lGK1SzwwxNJqwClE= From: Isaiah Poston To: musl@lists.openwall.com Cc: Isaiah Poston Date: Sat, 12 Mar 2022 18:21:56 -0600 Message-Id: <20220313002155.19029-1-isaiah@ilposton.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: ilposton.com Subject: [musl] [PATCH] use libc-internal malloc for duplocale newlocale and freelocale use __libc_malloc and __libc_free, but duplocale uses malloc. This prevents invalid reads when locales created by duplocale use a different malloc allocator than the internal one (e.g. when using an LD_PRELOAD malloc tool such as valgrind). This bug was introduced by commit 1e4204d522670a1d8b8ab85f1cfefa960547e8af. --- src/locale/duplocale.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/locale/duplocale.c b/src/locale/duplocale.c index 030b64cb..5ce33ae6 100644 --- a/src/locale/duplocale.c +++ b/src/locale/duplocale.c @@ -3,6 +3,11 @@ #include "locale_impl.h" #include "libc.h" +#define malloc __libc_malloc +#define calloc undef +#define realloc undef +#define free undef + locale_t __duplocale(locale_t old) { locale_t new = malloc(sizeof *new); -- 2.35.1