Skip to content

Commit

Permalink
In some instances, the regcomp() implementation would inadvertently s…
Browse files Browse the repository at this point in the history
…ign-extend

a character in the regular expression.  Additionally, alphabetic wide-characters
were not properly being considered as such

Obtained from: FreeBSD
  • Loading branch information
laffer1 committed Nov 8, 2023
1 parent e26b805 commit 5abe104
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/libc/regex/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,10 @@ p_simp_re(struct parse *p, struct branchc *bc)
handled = false;

assert(MORE()); /* caller should have ensured this */
c = GETNEXT();
c = (uch)GETNEXT();
if (c == '\\') {
(void)REQUIRE(MORE(), REG_EESCAPE);
cc = GETNEXT();
cc = (uch)GETNEXT();
c = BACKSL | cc;
#ifdef LIBREGEX
if (p->gnuext) {
Expand Down Expand Up @@ -977,7 +977,7 @@ p_count(struct parse *p)
int ndigits = 0;

while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
count = count*10 + (GETNEXT() - '0');
count = count*10 + ((uch)GETNEXT() - '0');
ndigits++;
}

Expand Down Expand Up @@ -1287,7 +1287,7 @@ may_escape(struct parse *p, const wint_t ch)

if ((p->pflags & PFLAG_LEGACY_ESC) != 0)
return (true);
if (isalpha(ch) || ch == '\'' || ch == '`')
if (iswalpha(ch) || ch == '\'' || ch == '`')
return (false);
return (true);
#ifdef NOTYET
Expand Down

0 comments on commit 5abe104

Please sign in to comment.