public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] When gas/read.c calls mbstowcs with a NULL destination, it should set size to 0
@ 2022-08-05 9:30 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2022-08-05 9:30 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5858ac626e548772407c038b09b7837550b127dd
commit 5858ac626e548772407c038b09b7837550b127dd
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Aug 5 10:29:48 2022 +0100
When gas/read.c calls mbstowcs with a NULL destination, it should set size to 0
PR 29447
* read.c (read_symbol_name): Pass 0 as the length parameter when
invoking mbstowc in order to check the validity of a wide string.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/read.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5a391a22636..f6b357709b2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2022-08-05 Nick Clifton <nickc@redhat.com>
+
+ PR 29447
+ * read.c (read_symbol_name): Pass 0 as the length parameter when
+ invoking mbstowc in order to check the validity of a wide string.
+
2022-07-18 Claudiu Zissulescu <claziss@synopsys.com>
* config/tc-arc.c (md_assembly): Update strspn string with the
diff --git a/gas/read.c b/gas/read.c
index 800712466be..e23be666dde 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1629,7 +1629,10 @@ read_symbol_name (void)
/* Since quoted symbol names can contain non-ASCII characters,
check the string and warn if it cannot be recognised by the
current character set. */
- if (mbstowcs (NULL, name, len) == (size_t) -1)
+ /* PR 29447: mbstowcs ignores the third (length) parameter when
+ the first (destination) parameter is NULL. For clarity sake
+ therefore we pass 0 rather than 'len' as the third parameter. */
+ if (mbstowcs (NULL, name, 0) == (size_t) -1)
as_warn (_("symbol name not recognised in the current locale"));
}
else if (is_name_beginner (c) || (input_from_string && c == FAKE_LABEL_CHAR))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-05 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 9:30 [binutils-gdb] When gas/read.c calls mbstowcs with a NULL destination, it should set size to 0 Nick Clifton
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).