From owner-svn-src-all@freebsd.org Fri Dec 18 05:37:18 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 7A34EA4AD38; Fri, 18 Dec 2015 05:37:18 +0000 (UTC) (envelope-from luke.tw@gmail.com) Received: from mail-yk0-x230.google.com (mail-yk0-x230.google.com [IPv6:2607:f8b0:4002:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 412531D26; Fri, 18 Dec 2015 05:37:18 +0000 (UTC) (envelope-from luke.tw@gmail.com) Received: by mail-yk0-x230.google.com with SMTP id x184so46722052yka.3; Thu, 17 Dec 2015 21:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=zxD2aSsakVAkKCaEIRCG1WKc2Lv71ZQqQroybEO5hZw=; b=fdgcpnvuyPRSxhjPHsIWjZ7kryICMJ/8H143NQZbTdvPEHNhAwtfs/n9KmgOZ0pxF5 nNsnbSMlxmTYO+4H1oIHDJFhpGOl4hUpt/ZL1q6f5HS8eNffrsnhijZQw8r0qWv/GUFr pGx46lzw6ztR5oCu7kbZfVAQnj6BPyPLZ2Yjqa+EiZr7wIW+zHdG+xloaT6okijLzsoz T5Vfsfom4gvny6OaFLesIwcPtjOpA7tHOv46JnUfczEY9E0M+crUs4v6b7kOGsNa+0Hg qgcxApXMmNiV+SljMLM97wjt/BmFu/G2O5wiVmcnUGhGhbQ/kQDQP+4F9ytiV6JM5gso GT5w== X-Received: by 10.13.198.199 with SMTP id i190mr1281946ywd.255.1450417036827; Thu, 17 Dec 2015 21:37:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.16.6 with HTTP; Thu, 17 Dec 2015 21:36:47 -0800 (PST) In-Reply-To: <201512172042.tBHKg5bM091931@repo.freebsd.org> References: <201512172042.tBHKg5bM091931@repo.freebsd.org> From: luke Date: Fri, 18 Dec 2015 13:36:47 +0800 Message-ID: Subject: Re: svn commit: r292410 - head/usr.sbin/boot0cfg To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Fri, 18 Dec 2015 05:37:18 -0000 On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin wrote: > 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); > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > Hi, Should the check be against *mbr ? + if (*mbr == NULL) + errx(1, "%s: unable to allocate MBR buffer", disk); -- Luke Chang-Hsien Tsai