Author: jhb Date: Tue Jan 19 19:04:56 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 <kuleshovm...@gmail.com> Modified: stable/10/usr.sbin/boot0cfg/boot0cfg.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/usr.sbin/boot0cfg/boot0cfg.c Directory Properties: stable/9/usr.sbin/boot0cfg/ (props changed) Modified: stable/10/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- stable/10/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 19 18:57:37 2016 (r294337) +++ stable/10/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 19 19:04:56 2016 (r294338) @@ -336,7 +336,8 @@ read_mbr(const char *disk, u_int8_t **mb close(fd); return (mbr_size); } - *mbr = malloc(sizeof(buf)); + if ((*mbr = malloc(sizeof(buf))) == NULL) + errx(1, "%s: unable to allocate MBR buffer", disk); memcpy(*mbr, buf, sizeof(buf)); close(fd); _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"