Date: Wed, 1 Apr 2015 10:02:29 +0000 (UTC) From: Roger Pau Monné <royger@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280953 - head/sys/boot/i386/libi386 Message-ID: <201504011002.t31A2TrN085678@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: royger Date: Wed Apr 1 10:02:28 2015 New Revision: 280953 URL: https://svnweb.freebsd.org/changeset/base/280953 Log: multiboot: zero mod list array Zero the list of modules array before using it, or else we might pass uninitialized data in unused fields of the struct that will make Xen choke. Also add a check to make sure malloc succeeds. Sponsored by: Citrix Systems R&D Modified: head/sys/boot/i386/libi386/multiboot.c Modified: head/sys/boot/i386/libi386/multiboot.c ============================================================================== --- head/sys/boot/i386/libi386/multiboot.c Wed Apr 1 08:37:50 2015 (r280952) +++ head/sys/boot/i386/libi386/multiboot.c Wed Apr 1 10:02:28 2015 (r280953) @@ -274,7 +274,14 @@ multiboot_exec(struct preloaded_file *fp error = EFTYPE; goto error; } + mb_mod = malloc(sizeof(struct multiboot_mod_list) * NUM_MODULES); + if (mb_mod == NULL) { + error = ENOMEM; + goto error; + } + + bzero(mb_mod, sizeof(struct multiboot_mod_list) * NUM_MODULES); /* * Calculate how much memory is needed for the metatdata. We did
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504011002.t31A2TrN085678>