From owner-svn-src-stable-9@freebsd.org Tue Jan 19 19:04:58 2016 Return-Path: Delivered-To: svn-src-stable-9@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 564F8A895A7; Tue, 19 Jan 2016 19:04:58 +0000 (UTC) (envelope-from jhb@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 28FBC1747; Tue, 19 Jan 2016 19:04:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0JJ4vcL099400; Tue, 19 Jan 2016 19:04:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0JJ4vDt099399; Tue, 19 Jan 2016 19:04:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201601191904.u0JJ4vDt099399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 19 Jan 2016 19:04:57 +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: r294338 - in stable: 10/usr.sbin/boot0cfg 9/usr.sbin/boot0cfg 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-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 19:04:58 -0000 Author: jhb Date: Tue Jan 19 19:04:56 2016 New Revision: 294338 URL: https://svnweb.freebsd.org/changeset/base/294338 Log: MFC 292410,292443,293977: Exit cleanly if malloc() fails to allocate a buffer for a copy of the current MBR. PR: 205322 Submitted by: Alexander Kuleshov Modified: stable/9/usr.sbin/boot0cfg/boot0cfg.c Directory Properties: stable/9/usr.sbin/boot0cfg/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/boot0cfg/boot0cfg.c Directory Properties: stable/10/ (props changed) Modified: stable/9/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- stable/9/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 19 18:57:37 2016 (r294337) +++ stable/9/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 19 19:04:56 2016 (r294338) @@ -334,7 +334,8 @@ read_mbr(const char *disk, u_int8_t **mb errx(1, "%s: short read", disk); return (mbr_size); } - *mbr = malloc(sizeof(buf)); + if ((*mbr = malloc(sizeof(buf))) == NULL) + errx(1, "%s: unable to allocate MBR buffer", disk); memcpy(*mbr, buf, sizeof(buf)); return sizeof(buf);