aboutsummaryrefslogtreecommitdiff
path: root/gas/macro.c
diff options
context:
space:
mode:
authorWu Heng <wu.heng@zte.com.cn>2019-01-04 16:18:59 +0000
committerNick Clifton <nickc@redhat.com>2019-01-04 16:18:59 +0000
commit1b2ed39c3a7ee2870f3d16a510d31e8d5916afbc (patch)
tree927a97088ca66510ff584d58ba37ff2ab15f8c93 /gas/macro.c
parentbdfb4455977ffdd2d3f8dc81f25f6ba1ea2a7f49 (diff)
downloadgdb-1b2ed39c3a7ee2870f3d16a510d31e8d5916afbc.zip
gdb-1b2ed39c3a7ee2870f3d16a510d31e8d5916afbc.tar.gz
gdb-1b2ed39c3a7ee2870f3d16a510d31e8d5916afbc.tar.bz2
Fix potential buffer overrun whilst scanning macro strings.
PR 24010 * macro.c (get_any_string): Check for end of input whilst scanning for separators.
Diffstat (limited to 'gas/macro.c')
-rw-r--r--gas/macro.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/macro.c b/gas/macro.c
index a1a2323..68ae04b 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -369,7 +369,7 @@ get_any_string (size_t idx, sb *in, sb *out)
{
if (in->len > idx + 2 && in->ptr[idx + 1] == '\'' && ISBASE (in->ptr[idx]))
{
- while (!ISSEP (in->ptr[idx]))
+ while (idx < in->len && !ISSEP (in->ptr[idx]))
sb_add_char (out, in->ptr[idx++]);
}
else if (in->ptr[idx] == '%' && macro_alternate)