public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: libc-stable@sourceware.org
Cc: Noah Goldstein <goldstein.w.n@gmail.com>,
	Siddhesh Poyarekar <siddhesh@sourceware.org>
Subject: [COMMITTED 2.35 2/2] stdlib: Fixup mbstowcs NULL __dst handling. [BZ #29279]
Date: Mon, 15 Aug 2022 23:13:37 +0200	[thread overview]
Message-ID: <20220815211337.2335726-2-aurelien@aurel32.net> (raw)
In-Reply-To: <20220815211337.2335726-1-aurelien@aurel32.net>

From: Noah Goldstein <goldstein.w.n@gmail.com>

commit 464d189b9622932a75302290625de84931656ec0 (origin/master, origin/HEAD)
Author: Noah Goldstein <goldstein.w.n@gmail.com>
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 <siddhesh@sourceware.org>

(cherry picked from commit 220b83d83d32aa9e6f5659e2fa2a63a0024c3e4a)
---
 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);
-- 
2.35.1


      reply	other threads:[~2022-08-15 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 21:13 [COMMITTED 2.35 1/2] stdlib: Remove attr_write from mbstows if dst is NULL [BZ: 29265] Aurelien Jarno
2022-08-15 21:13 ` Aurelien Jarno [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220815211337.2335726-2-aurelien@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=goldstein.w.n@gmail.com \
    --cc=libc-stable@sourceware.org \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).