From 10c172ba93dde7cb7c46982ca217e646565bf938 Mon Sep 17 00:00:00 2001 From: Wu Heng Date: Fri, 25 Jan 2019 13:41:47 +1030 Subject: PR23940, check bounds before using PR gas/23940 * macro.c (getstring): Check array bound before accessing. --- gas/macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gas/macro.c') 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] == '!') { -- cgit v1.1