NetBSD/lib/libc/regex
christos b0735e4145 Add some better error handling from FreeBSD, although we don't
suffer from the same issue, since we don't decrement p->next, like
FreeBSD does because we don't have multibyte support (yet). We
choose to do this so we can fail faster and more predictably.

Here's the original FreeBSD message:

When passed the invalid regular expression "a**", the error is
eventually detected and seterr() is called. It sets p->error
appropriatly and p->next and p->end to nuls which is a never used char
nuls[10] which is zeros due to .bss initialization. Unfortunatly,
p_ere_exp() and p_simp_re() both have fall through cases where they set
the error, decrement p->next and access it which means a read from what
ever .bss variable comes before nuls.

Found with regex_test:repet_multi and CHERI bounds checking.

Reviewed by:	ngie, pfg, emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10541
2019-02-07 22:22:31 +00:00
..
COPYRIGHT
Makefile.inc
WHATSNEW
cclass.h
cname.h
engine.c
re_format.7
regcomp.c Add some better error handling from FreeBSD, although we don't 2019-02-07 22:22:31 +00:00
regerror.c
regex.3
regex2.h
regexec.c
regfree.c
regsub.c
utils.h