From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id 30E9D3858CDA for ; Wed, 26 Apr 2023 06:26:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30E9D3858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy06.your-server.de ([78.46.172.3]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1prYbN-000EmF-Ue for newlib@sourceware.org; Wed, 26 Apr 2023 08:26:05 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prYbN-0001Cb-Ri for newlib@sourceware.org; Wed, 26 Apr 2023 08:26:05 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 8375D48017C for ; Wed, 26 Apr 2023 08:26:05 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id HSZcxtQo4CXJ for ; Wed, 26 Apr 2023 08:26:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 2EB2D48017F for ; Wed, 26 Apr 2023 08:26:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id c6SoHOkY4SGx for ; Wed, 26 Apr 2023 08:26:05 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [192.168.96.242]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 0E47148017C for ; Wed, 26 Apr 2023 08:26:05 +0200 (CEST) From: Sebastian Huber To: newlib@sourceware.org Subject: [PATCH] Fix _REENT_EMERGENCY() if TLS is enabled Date: Wed, 26 Apr 2023 08:26:02 +0200 Message-Id: <20230426062602.121012-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.8/26887/Tue Apr 25 09:23:39 2023) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: If the thread-local storage (TLS) support was enabled, the _REENT_EMERGEN= CY() object had the wrong size. It must be a buffer of length _REENT_EMERGENC= Y_SIZE and not just a single character. --- newlib/libc/include/sys/reent.h | 2 +- newlib/libc/stdio/tmpnam.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/re= ent.h index 6d8b005b2b..c71f75dbc2 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -812,7 +812,7 @@ extern _Thread_local int _tls_cvtlen; #define _REENT_CVTLEN(_ptr) (_tls_cvtlen) extern _Thread_local void (*_tls_cleanup)(struct _reent *); #define _REENT_CLEANUP(_ptr) (_tls_cleanup) -extern _Thread_local char _tls_emergency; +extern _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE]; #define _REENT_EMERGENCY(_ptr) (_tls_emergency) extern _Thread_local int _tls_errno; #define _REENT_ERRNO(_ptr) (_tls_errno) diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c index 51dfd1cea6..dc04cf3f6c 100644 --- a/newlib/libc/stdio/tmpnam.c +++ b/newlib/libc/stdio/tmpnam.c @@ -84,7 +84,7 @@ The global pointer <> is also required. =20 #ifdef _REENT_THREAD_LOCAL _Thread_local int _tls_inc; -_Thread_local char _tls_emergency; +_Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE]; #endif =20 /* Try to open the file specified, if it can't be opened then try --=20 2.35.3