aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_core.c
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2013-06-14 16:45:40 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2013-06-14 16:45:40 +0100
commit117a538dbef62f8d39159dea652e633e01b50a9a (patch)
tree37f763d3cddc4e739feb92294f3a3349507feeb1 /tools/libxc/xc_dom_core.c
parent40b76f1fb04af421c1415f7bcb168dfaa6960d0d (diff)
downloadxen-117a538dbef62f8d39159dea652e633e01b50a9a.tar.gz
xen-117a538dbef62f8d39159dea652e633e01b50a9a.tar.bz2
xen-117a538dbef62f8d39159dea652e633e01b50a9a.zip
libxc: check failure of xc_dom_*_to_ptr, xc_map_foreign_range
The return values from xc_dom_*_to_ptr and xc_map_foreign_range are sometimes dereferenced, or subjected to pointer arithmetic, without checking whether the relevant function failed and returned NULL. Add an appropriate error check at every call site. Changes in the 4.2 backport of this series: * Fix tools/libxc/xc_dom_x86.c:setup_pgtables_x86_32. * Fix tools/libxc/xc_dom_ia64.c:start_info_ia64. * Fix tools/libxc/ia64/xc_ia64_dom_fwloader.c:xc_dom_load_fw_kernel. Conflicts in the 4.1 backport of this series: * xc_dom_load_elf_kernel has less error handling in 4.1. * the VM generation ID code is not in 4.1. This is part of the fix to a security issue, XSA-55. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_dom_core.c')
-rw-r--r--tools/libxc/xc_dom_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 8913e41060..a54ddae3d3 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -868,6 +868,12 @@ int xc_dom_build_image(struct xc_dom_image *dom)
ramdisklen) != 0 )
goto err;
ramdiskmap = xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg);
+ if ( ramdiskmap == NULL )
+ {
+ DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg) => NULL",
+ __FUNCTION__);
+ goto err;
+ }
if ( unziplen )
{
if ( xc_dom_do_gunzip(dom->xch,