mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
common: Fix minor bug in the jimregexp code.
* regexp/jimregexp.c (regatom): Make error checking for stray backslash at end of the string work. Check that the pattern class is closed by a bracket. -- GnuPG-bug-id: 6455 Co-authored-by: Guldrelokk
This commit is contained in:
parent
e1663c0450
commit
a82e6f310a
@ -778,7 +778,7 @@ static int regatom(regex_t *preg, int *flagp)
|
|||||||
preg->err = REG_ERR_NULL_CHAR;
|
preg->err = REG_ERR_NULL_CHAR;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (start == '\\' && *pattern == 0) {
|
if (end == '\\' && *pattern == 0) {
|
||||||
preg->err = REG_ERR_INVALID_ESCAPE;
|
preg->err = REG_ERR_INVALID_ESCAPE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -795,7 +795,8 @@ 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) == 0) {
|
if (!strncmp(pattern, character_class[cc], n)
|
||||||
|
&& pattern[n] == ']') {
|
||||||
/* Found a character class */
|
/* Found a character class */
|
||||||
pattern += n + 1;
|
pattern += n + 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user