Bug 205322 - [PATCH] boot0cfg: check result of the malloc()
Summary: [PATCH] boot0cfg: check result of the malloc()
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: John Baldwin
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-12-14 18:24 UTC by Alexander Kuleshov
Modified: 2016-01-19 19:09 UTC (History)
3 users (show)

See Also:
jhb: mfc-stable10?
jhb: mfc-stable9?


Attachments
check malloc result (961 bytes, patch)
2015-12-14 18:24 UTC, Alexander Kuleshov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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