]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r317707:
authorbrooks <brooks@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 9 May 2017 16:29:06 +0000 (16:29 +0000)
committerbrooks <brooks@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 9 May 2017 16:29:06 +0000 (16:29 +0000)
commit43265d78098def9a811b4b3d47d70f86cce2189a
tree82c349ea23ccde27eb48c5f403c39a2756d6b309
parent6560377c6da5f7be062c0f26f81742442a493540
MFC r317707:

Correct an out-of-bounds read in regcomp when the RE is bad.

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
whatever .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
Differential Revision: https://reviews.freebsd.org/D10541

git-svn-id: svn://svn.freebsd.org/base/stable/10@318030 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/regex/regcomp.c