mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
common: Incorporate upstream changes of regexp.
* regexp/jimregexp.c (regatom): Raise REG_ERR_UNMATCHED_BRACKET when no matching end bracket. (regmatch): Fix the end of word check. -- Original changes: Signed-off-by: Steve Bennett <steveb@workware.net.au> GnuPG-bug-id: 6455 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
af3724d383
commit
762b7d07ea
@ -795,8 +795,11 @@ static int regatom(regex_t *preg, int *flagp)
|
|||||||
|
|
||||||
for (cc = 0; cc < CC_NUM; cc++) {
|
for (cc = 0; cc < CC_NUM; cc++) {
|
||||||
n = strlen(character_class[cc]);
|
n = strlen(character_class[cc]);
|
||||||
if (!strncmp(pattern, character_class[cc], n)
|
if (strncmp(pattern, character_class[cc], n) == 0) {
|
||||||
&& pattern[n] == ']') {
|
if (pattern[n] != ']') {
|
||||||
|
preg->err = REG_ERR_UNMATCHED_BRACKET;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* Found a character class */
|
/* Found a character class */
|
||||||
pattern += n + 1;
|
pattern += n + 1;
|
||||||
break;
|
break;
|
||||||
@ -1508,7 +1511,7 @@ static int regmatch(regex_t *preg, int prog)
|
|||||||
/* Can't match at BOL */
|
/* Can't match at BOL */
|
||||||
if (preg->reginput > preg->regbol) {
|
if (preg->reginput > preg->regbol) {
|
||||||
/* Current must be EOL or nonword */
|
/* Current must be EOL or nonword */
|
||||||
if (reg_iseol(preg, c) || !isalnum(UCHAR(c)) || c != '_') {
|
if (reg_iseol(preg, c) || !(isalnum(UCHAR(c)) || c == '_')) {
|
||||||
c = preg->reginput[-1];
|
c = preg->reginput[-1];
|
||||||
/* Previous must be word */
|
/* Previous must be word */
|
||||||
if (isalnum(UCHAR(c)) || c == '_') {
|
if (isalnum(UCHAR(c)) || c == '_') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user