From owner-svn-src-all@freebsd.org Thu Dec 17 20:42:07 2015 Return-Path: Delivered-To: svn-src-all@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 5DF5EA4B61A; Thu, 17 Dec 2015 20:42:07 +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 28A441C7D; Thu, 17 Dec 2015 20:42:07 +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 tBHKg5Hd091932; Thu, 17 Dec 2015 20:42:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBHKg5bM091931; Thu, 17 Dec 2015 20:42:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201512172042.tBHKg5bM091931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Dec 2015 20:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292410 - head/usr.sbin/boot0cfg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2015 20:42:07 -0000 Author: jhb Date: Thu Dec 17 20:42:05 2015 New Revision: 292410 URL: https://svnweb.freebsd.org/changeset/base/292410 Log: Exit cleanly if malloc() fails to allocate a buffer for a copy of the current MBR. PR: 205322 Submitted by: Alexander Kuleshov MFC after: 1 week Modified: head/usr.sbin/boot0cfg/boot0cfg.c Modified: head/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.c Thu Dec 17 20:33:20 2015 (r292409) +++ head/usr.sbin/boot0cfg/boot0cfg.c Thu Dec 17 20:42:05 2015 (r292410) @@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb return (mbr_size); } *mbr = malloc(sizeof(buf)); + if (mbr == NULL) + errx(1, "%s: unable to allocate MBR buffer", disk); memcpy(*mbr, buf, sizeof(buf)); close(fd);