From owner-svn-src-head@freebsd.org Tue Mar 21 18:02:16 2017 Return-Path: Delivered-To: svn-src-head@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 02838D16ECF; Tue, 21 Mar 2017 18:02:16 +0000 (UTC) (envelope-from emaste@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 C2A571011; Tue, 21 Mar 2017 18:02:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2LI2ExF042391; Tue, 21 Mar 2017 18:02:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2LI2E1R042390; Tue, 21 Mar 2017 18:02:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201703211802.v2LI2E1R042390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Mar 2017 18:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315685 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 18:02:16 -0000 Author: emaste Date: Tue Mar 21 18:02:14 2017 New Revision: 315685 URL: https://svnweb.freebsd.org/changeset/base/315685 Log: tighten buffer bounds in imgact_binmisc_populate_interp We must ensure there's space for the terminating null in the temporary buffer in imgact_binmisc_populate_interp(). Note that there's no buffer overflow here because xbe->xbe_interpreter's length and null termination is checked in imgact_binmisc_add_entry() before imgact_binmisc_populate_interp() is called. However, the latter should correctly enforce its own bounds. Reviewed by: sbruno MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10042 Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Tue Mar 21 16:23:44 2017 (r315684) +++ head/sys/kern/imgact_binmisc.c Tue Mar 21 18:02:14 2017 (r315685) @@ -120,7 +120,7 @@ imgact_binmisc_populate_interp(char *str sp = str; tp = t; while (*sp != '\0') { if (*sp == ' ' || *sp == '\t') { - if (++len > IBE_INTERP_LEN_MAX) + if (++len >= IBE_INTERP_LEN_MAX) break; *tp++ = ' '; argc++;