diff options
Diffstat (limited to 'contrib/less/brac.c')
-rw-r--r-- | contrib/less/brac.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/less/brac.c b/contrib/less/brac.c index 53ada50aab56..da4efab8605e 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2021 Mark Nudelman + * Copyright (C) 1984-2023 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -23,12 +23,7 @@ * The characters which serve as "open bracket" and * "close bracket" are given. */ - public void -match_brac(obrac, cbrac, forwdir, n) - int obrac; - int cbrac; - int forwdir; - int n; +public void match_brac(char obrac, char cbrac, int forwdir, int n) { int c; int nest; @@ -84,7 +79,11 @@ match_brac(obrac, cbrac, forwdir, n) while ((c = (*chget)()) != EOI) { if (c == obrac) + { + if (nest == INT_MAX) + break; nest++; + } else if (c == cbrac && --nest < 0) { /* |