From owner-svn-src-stable@freebsd.org Thu Apr 28 01:12:40 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 319E1B1E7EF; Thu, 28 Apr 2016 01:12:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 013811EE3; Thu, 28 Apr 2016 01:12:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3S1CdAl015588; Thu, 28 Apr 2016 01:12:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3S1CdH2015587; Thu, 28 Apr 2016 01:12:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604280112.u3S1CdH2015587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 28 Apr 2016 01:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298727 - stable/9/lib/libc/regex X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 01:12:40 -0000 Author: pfg Date: Thu Apr 28 01:12:38 2016 New Revision: 298727 URL: https://svnweb.freebsd.org/changeset/base/298727 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/9/lib/libc/regex/engine.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/regex/engine.c ============================================================================== --- stable/9/lib/libc/regex/engine.c Thu Apr 28 01:11:25 2016 (r298726) +++ stable/9/lib/libc/regex/engine.c Thu Apr 28 01:12:38 2016 (r298727) @@ -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®_TRACE))