From owner-svn-src-head@freebsd.org Fri Jul 29 16:14:04 2016 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 5FE1ABA8F5B; Fri, 29 Jul 2016 16:14:04 +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 2FFAF1155; Fri, 29 Jul 2016 16:14:04 +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 u6TGE3fL060512; Fri, 29 Jul 2016 16:14:03 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6TGE35m060511; Fri, 29 Jul 2016 16:14:03 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607291614.u6TGE35m060511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 29 Jul 2016 16:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303483 - head/usr.bin/indent 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.22 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: Fri, 29 Jul 2016 16:14:04 -0000 Author: pfg Date: Fri Jul 29 16:14:03 2016 New Revision: 303483 URL: https://svnweb.freebsd.org/changeset/base/303483 Log: indent(1): Avoid potential use-after-free. last_bl is a char pointer that tracks the last blank character in a comment, which is used for wrapping long comment lines. Since the underlying array may be reallocated, make sure last_bl is up to date when that happens. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from: Piotr Stefaniak Modified: head/usr.bin/indent/indent_globs.h Modified: head/usr.bin/indent/indent_globs.h ============================================================================== --- head/usr.bin/indent/indent_globs.h Fri Jul 29 16:09:05 2016 (r303482) +++ head/usr.bin/indent/indent_globs.h Fri Jul 29 16:14:03 2016 (r303483) @@ -71,6 +71,7 @@ FILE *output; /* the output file if (combuf == NULL) \ err(1, NULL); \ e_com = combuf + (e_com-s_com) + 1; \ + last_bl = combuf + (last_bl-s_com) + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ }