regex: prevent two improbable signed integer overflows.

In matcher() we used an integer to index nsub of type size_t.
In print() we used an integer to index nstates of type sopno,
typedef'd long.
In both cases the indexes never take negative values.

Match the types to avoid any error.

MFC after:	5 days
This commit is contained in:
Pedro F. Giffuni 2016-04-23 20:45:09 +00:00
parent 6c960bf07f
commit 039b877ef0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298521

View File

@ -154,7 +154,7 @@ matcher(struct re_guts *g,
int eflags)
{
const char *endp;
int i;
size_t i;
struct match mv;
struct match *m = &mv;
const char *dp = NULL;
@ -1108,7 +1108,7 @@ print(struct match *m,
FILE *d)
{
struct re_guts *g = m->g;
int i;
sopno i;
int first = 1;
if (!(m->eflags&REG_TRACE))