From owner-svn-src-stable@freebsd.org Mon Dec 26 16:27:03 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 47C96C9169D; Mon, 26 Dec 2016 16:27:03 +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 E4F8411A6; Mon, 26 Dec 2016 16:27:02 +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 uBQGR2sK091032; Mon, 26 Dec 2016 16:27:02 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQGR17F091029; Mon, 26 Dec 2016 16:27:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612261627.uBQGR17F091029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 26 Dec 2016 16:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310604 - stable/11/bin/ed X-SVN-Group: stable-11 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.23 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: Mon, 26 Dec 2016 16:27:03 -0000 Author: pfg Date: Mon Dec 26 16:27:01 2016 New Revision: 310604 URL: https://svnweb.freebsd.org/changeset/base/310604 Log: MFC r309873: ed(1): Prevent possible overflows during allocation. Make sure the parameters used for malloc(3) can hold size_t sizes. This should help ed(1) handle bigger data in the future. Modified: stable/11/bin/ed/ed.h stable/11/bin/ed/glbl.c stable/11/bin/ed/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/ed/ed.h ============================================================================== --- stable/11/bin/ed/ed.h Mon Dec 26 15:24:12 2016 (r310603) +++ stable/11/bin/ed/ed.h Mon Dec 26 16:27:01 2016 (r310604) @@ -115,7 +115,7 @@ if (--mutex == 0) { \ /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ - int ti = (n); \ + size_t ti = (n); \ char *ts; \ SPL1(); \ if ((b) != NULL) { \ @@ -141,7 +141,7 @@ if ((i) > (n)) { \ /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ - int ti = (n); \ + size_t ti = (n); \ char *ts; \ SPL1(); \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ Modified: stable/11/bin/ed/glbl.c ============================================================================== --- stable/11/bin/ed/glbl.c Mon Dec 26 15:24:12 2016 (r310603) +++ stable/11/bin/ed/glbl.c Mon Dec 26 16:27:01 2016 (r310604) @@ -146,7 +146,7 @@ int set_active_node(line_t *lp) { if (active_last + 1 > active_size) { - int ti = active_size; + size_t ti = active_size; line_t **ts; SPL1(); #if defined(sun) || defined(NO_REALLOC_NULL) Modified: stable/11/bin/ed/main.c ============================================================================== --- stable/11/bin/ed/main.c Mon Dec 26 15:24:12 2016 (r310603) +++ stable/11/bin/ed/main.c Mon Dec 26 16:27:01 2016 (r310604) @@ -1356,7 +1356,7 @@ handle_hup(int signo) char *hup = NULL; /* hup filename */ char *s; char ed_hup[] = "ed.hup"; - int n; + size_t n; if (!sigactive) quit(1);