Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 2015 21:53:36 -0800
From:      Garrett Cooper <yaneurabeya@gmail.com>
To:        luke <luke.tw@gmail.com>
Cc:        John Baldwin <jhb@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r292410 - head/usr.sbin/boot0cfg
Message-ID:  <30CD0290-06B9-4024-8EEE-F25090608D46@gmail.com>
In-Reply-To: <CAGVycpY1b7dZ2srj8xHai6EvcaDa2uFCVJRh6WbFdH3GF7txFA@mail.gmail.com>
References:  <201512172042.tBHKg5bM091931@repo.freebsd.org> <CAGVycpY1b7dZ2srj8xHai6EvcaDa2uFCVJRh6WbFdH3GF7txFA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Dec 17, 2015, at 21:36, luke <luke.tw@gmail.com> wrote:
>=20
>> On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin <jhb@freebsd.org> wrote:
>> Author: jhb
>> Date: Thu Dec 17 20:42:05 2015
>> New Revision: 292410
>> URL: https://svnweb.freebsd.org/changeset/base/292410
>>=20
>> Log:
>>   Exit cleanly if malloc() fails to allocate a buffer for a copy of the
>>   current MBR.
>>=20
>>   PR:           205322
>>   Submitted by: Alexander Kuleshov <kuleshovmail@gmail.com>
>>   MFC after:    1 week
>>=20
>> Modified:
>>   head/usr.sbin/boot0cfg/boot0cfg.c
>>=20
>> Modified: head/usr.sbin/boot0cfg/boot0cfg.c
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
>> --- 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 =3D malloc(sizeof(buf));
>> +    if (mbr =3D=3D NULL)
>> +       errx(1, "%s: unable to allocate MBR buffer", disk);
>>      memcpy(*mbr, buf, sizeof(buf));
>>      close(fd);


> Hi,=20
>=20
> Should the check be against *mbr  ?
> +    if (*mbr =3D=3D NULL)
> +       errx(1, "%s: unable to allocate MBR buffer", disk);

Yup!=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?30CD0290-06B9-4024-8EEE-F25090608D46>