Date: Sat, 23 Apr 2016 20:45:09 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298521 - head/lib/libc/regex Message-ID: <201604232045.u3NKj9tC014765@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sat Apr 23 20:45:09 2016 New Revision: 298521 URL: https://svnweb.freebsd.org/changeset/base/298521 Log: 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 Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Apr 23 20:31:18 2016 (r298520) +++ head/lib/libc/regex/engine.c Sat Apr 23 20:45:09 2016 (r298521) @@ -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®_TRACE))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604232045.u3NKj9tC014765>