Pedro F. Giffuni 0f23ab8aac Fix out-of-bounds read in libc/regex.
The bug is an out-of-bounds read detected with address sanitizer that
happens when 'sp' in p_b_coll_elems() includes NUL byte[s], e.g. if it's
equal to "GS\x00". In that case len will be equal to 4, and the
strncmp(cp->name, sp, len) call will succeed when cp->name is "GS" but the
cp->name[len] == '\0' comparison will cause the read to go out-of-bounds.

Checking the length using strlen() instead eliminates the issue.

The bug was found in LLVM with oss-fuzz:
	https://reviews.llvm.org/D39380

MFC after:	1 week
Obtained from:	Vlad Tsyrklevich through posting on openbsd-tech
2017-10-28 20:09:34 +00:00
..
2017-10-01 00:40:23 +00:00
2017-10-28 19:23:57 +00:00
2017-02-28 23:42:47 +00:00
2017-08-02 09:00:59 +00:00
2017-09-17 19:14:38 +00:00
2017-10-23 16:55:22 +00:00
2017-02-14 13:35:59 +00:00
2017-08-03 18:07:01 +00:00
2017-02-28 23:42:47 +00:00
2017-10-05 23:01:33 +00:00
2017-10-28 19:23:57 +00:00