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
This commit is contained in:
parent
4ef184b756
commit
fbc3fb8fca
@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mbr, int check_version)
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user