summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-28 01:11:25 +0000
committerpfg <pfg@FreeBSD.org>2016-04-28 01:11:25 +0000
commit4d78336c424ca941ccdd2ead90e8e2beec434429 (patch)
tree69604d9a764e87d48ea8621d6ea40024e905cf4c /lib/libc/regex
parenta7708f42f754ca6ad0152f462f644a03765fc462 (diff)
downloadFreeBSD-src-4d78336c424ca941ccdd2ead90e8e2beec434429.zip
FreeBSD-src-4d78336c424ca941ccdd2ead90e8e2beec434429.tar.gz
MFC r298521;
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.
Diffstat (limited to 'lib/libc/regex')
-rw-r--r--lib/libc/regex/engine.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 589bb9d..72922f6 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -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;
@@ -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))
OpenPOWER on IntegriCloud