From owner-svn-src-stable@freebsd.org Mon May 29 15:24:47 2017 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 F41B8D4EC76; Mon, 29 May 2017 15:24:46 +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 C3A127D797; Mon, 29 May 2017 15:24:46 +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 v4TFOjT2055282; Mon, 29 May 2017 15:24:45 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4TFOjWc055281; Mon, 29 May 2017 15:24:45 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705291524.v4TFOjWc055281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 29 May 2017 15:24:45 +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: r319139 - stable/11/usr.sbin/bhyve 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, 29 May 2017 15:24:47 -0000 Author: pfg Date: Mon May 29 15:24:45 2017 New Revision: 319139 URL: https://svnweb.freebsd.org/changeset/base/319139 Log: MFC r318788: bhyvegc_resize: make use of reallocarray(3) for bounds-checking. Also add __FBSDID. Reviewed by: grehan Modified: stable/11/usr.sbin/bhyve/bhyvegc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyvegc.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyvegc.c Mon May 29 13:38:26 2017 (r319138) +++ stable/11/usr.sbin/bhyve/bhyvegc.c Mon May 29 15:24:45 2017 (r319139) @@ -1,4 +1,5 @@ #include +__FBSDID("$FreeBSD$"); #include @@ -56,9 +57,11 @@ bhyvegc_resize(struct bhyvegc *gc, int w gc_image->width = width; gc_image->height = height; if (!gc->raw) { - gc_image->data = realloc(gc_image->data, - sizeof (uint32_t) * width * height); - memset(gc_image->data, 0, width * height * sizeof (uint32_t)); + gc_image->data = reallocarray(gc_image->data, width * height, + sizeof (uint32_t)); + if (gc_image->data != NULL) + memset(gc_image->data, 0, width * height * + sizeof (uint32_t)); } }