From b155c9f7591942ad9fea8ca5775f8f8064d968ff Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 24 Apr 2022 06:25:53 +0600 Subject: [PATCH] check bound _before_ making access --- regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regex.c b/regex.c index 93406e8..15c7b35 100644 --- a/regex.c +++ b/regex.c @@ -747,7 +747,7 @@ lc2c(longchar * x, int len) int i = 0, j = 0; char *r; - while (x[j].type != RE_TYPE_END && j < len) { + while (j < len && x[j].type != RE_TYPE_END) { if (x[j].type == RE_WHICH_RANGE) y[i++] = '-'; #ifdef USE_M17N