Bug 205322

Summary: [PATCH] boot0cfg: check result of the malloc()
Product: Base System Reporter: Alexander Kuleshov <kuleshovmail>
Component: miscAssignee: John Baldwin <jhb>
Status: Closed FIXED    
Severity: Affects Only Me CC: jhb, kuleshovmail, phk
Priority: --- Keywords: patch
Version: CURRENTFlags: jhb: mfc-stable10?
jhb: mfc-stable9?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
check malloc result none

Description Alexander Kuleshov 2015-12-14 18:24:10 UTC
Created attachment 164240 [details]
check malloc result

Hello all,
                    
We are trying to allocate buffer for MBR in the read_mbr() function by the call of the malloc(). But it may return NULL in error case. This patch adds check for
this case.
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-12-17 20:42:35 UTC
A commit references this bug:

Author: jhb
Date: Thu Dec 17 20:42:06 UTC 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 <kuleshovmail@gmail.com>
  MFC after:	1 week

Changes:
  head/usr.sbin/boot0cfg/boot0cfg.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-01-19 19:05:07 UTC
A commit references this bug:

Author: jhb
Date: Tue Jan 19 19:04:57 UTC 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 <kuleshovmail@gmail.com>

Changes:
_U  stable/10/
  stable/10/usr.sbin/boot0cfg/boot0cfg.c
_U  stable/9/usr.sbin/boot0cfg/
  stable/9/usr.sbin/boot0cfg/boot0cfg.c