aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-08-05 10:29:48 +0100
committerNick Clifton <nickc@redhat.com>2022-08-05 10:29:48 +0100
commit5858ac626e548772407c038b09b7837550b127dd (patch)
tree24adcf531466743408c6d156fd712f421070e972 /gas/read.c
parent731d2cc1d5106c077584bd83e96dbba4f7e11118 (diff)
downloadgdb-5858ac626e548772407c038b09b7837550b127dd.zip
gdb-5858ac626e548772407c038b09b7837550b127dd.tar.gz
gdb-5858ac626e548772407c038b09b7837550b127dd.tar.bz2
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.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gas/read.c b/gas/read.c
index 8007124..e23be66 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))