Author: pfg
Date: Thu Apr 28 01:11:25 2016
New Revision: 298726
URL: https://svnweb.freebsd.org/changeset/base/298726

Log:
  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.

Modified:
  stable/10/lib/libc/regex/engine.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/regex/engine.c
==============================================================================
--- stable/10/lib/libc/regex/engine.c   Thu Apr 28 01:05:40 2016        
(r298725)
+++ stable/10/lib/libc/regex/engine.c   Thu Apr 28 01:11:25 2016        
(r298726)
@@ -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))
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to