aboutsummaryrefslogtreecommitdiff
path: root/gas/macro.c
diff options
context:
space:
mode:
authorWu Heng <wu.heng@zte.com.cn>2019-01-25 13:41:47 +1030
committerAlan Modra <amodra@gmail.com>2019-01-25 14:59:42 +1030
commit10c172ba93dde7cb7c46982ca217e646565bf938 (patch)
treeb1f331f272e017c40d7cb187fa85c5248de77e98 /gas/macro.c
parent04174263401c670b5faaaec452aee2df92130ef9 (diff)
downloadbinutils-10c172ba93dde7cb7c46982ca217e646565bf938.zip
binutils-10c172ba93dde7cb7c46982ca217e646565bf938.tar.gz
binutils-10c172ba93dde7cb7c46982ca217e646565bf938.tar.bz2
PR23940, check bounds before using
PR gas/23940 * macro.c (getstring): Check array bound before accessing.
Diffstat (limited to 'gas/macro.c')
-rw-r--r--gas/macro.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 68ae04b..5f41c13 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -285,8 +285,8 @@ getstring (size_t idx, sb *in, sb *acc)
{
int nest = 0;
idx++;
- while ((in->ptr[idx] != '>' || nest)
- && idx < in->len)
+ while (idx < in->len
+ && (in->ptr[idx] != '>' || nest))
{
if (in->ptr[idx] == '!')
{