From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7844) id 89D5238582A3; Thu, 23 Jun 2022 15:26:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89D5238582A3 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Noah Goldstein To: glibc-cvs@sourceware.org Subject: [glibc] stdlib: Fixup mbstowcs NULL __dst handling. [BZ #29279] X-Act-Checkin: glibc X-Git-Author: Noah Goldstein X-Git-Refname: refs/heads/master X-Git-Oldrev: 3079f652d7cc34456aefb412677c01e758922527 X-Git-Newrev: 220b83d83d32aa9e6f5659e2fa2a63a0024c3e4a Message-Id: <20220623152656.89D5238582A3@sourceware.org> Date: Thu, 23 Jun 2022 15:26:56 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 15:26:56 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=220b83d83d32aa9e6f5659e2fa2a63a0024c3e4a commit 220b83d83d32aa9e6f5659e2fa2a63a0024c3e4a Author: Noah Goldstein Date: Wed Jun 22 16:34:42 2022 -0700 stdlib: Fixup mbstowcs NULL __dst handling. [BZ #29279] commit 464d189b9622932a75302290625de84931656ec0 (origin/master, origin/HEAD) Author: Noah Goldstein Date: Wed Jun 22 08:24:21 2022 -0700 stdlib: Remove attr_write from mbstows if dst is NULL [BZ: 29265] Incorrectly called `__mbstowcs_chk` in the NULL __dst case which is incorrect as in the NULL __dst case we are explicitly skipping the objsize checks. As well, remove the `__always_inline` attribute which exists in `__fortify_function`. Reviewed-by: Siddhesh Poyarekar Diff: --- stdlib/bits/stdlib.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h index d9c2d822a5..de1c3b20f0 100644 --- a/stdlib/bits/stdlib.h +++ b/stdlib/bits/stdlib.h @@ -96,10 +96,10 @@ extern size_t __mbstowcs_chk (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen) __THROW __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2)); -extern size_t __REDIRECT_NTH (__mbstowcs_chk_nulldst, +extern size_t __REDIRECT_NTH (__mbstowcs_nulldst, (wchar_t *__restrict __dst, const char *__restrict __src, - size_t __len), mbstowcs_chk) + size_t __len), mbstowcs) __attr_access ((__read_only__, 2)); extern size_t __REDIRECT_NTH (__mbstowcs_alias, (wchar_t *__restrict __dst, @@ -113,12 +113,12 @@ extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn, __warnattr ("mbstowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); -__always_inline __fortify_function size_t +__fortify_function size_t __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len)) { if (__builtin_constant_p (__dst == NULL) && __dst == NULL) - return __mbstowcs_chk_nulldst (__dst, __src, __len); + return __mbstowcs_nulldst (__dst, __src, __len); else return __glibc_fortify_n (mbstowcs, __len, sizeof (wchar_t), __glibc_objsize (__dst), __dst, __src, __len);