parser - fix unbalanced ']' issue

A bug existed in the parser that it would not detect the error case
where an unquoted ']' is given without a matching '[' (the quoted
cases are accepted properly). This patch fixes the issue.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
Steve Beattie 2013-11-05 14:37:53 -08:00
parent 055b68289c
commit 61aebaeb4c

View file

@ -236,6 +236,10 @@ static pattern_t convert_aaregex_to_pcre(const char *aare, int anchor,
/* ] is a PCRE special character */
STORE("\\]", dptr, 2);
} else {
if (incharclass == 0) {
error = e_parse_error;
PERROR(_("%s: Regex grouping error: Invalid close ], no matching open [ detected\n"), progname);
}
incharclass = 0;
STORE(sptr, dptr, 1);
}