[Pkg-libvirt-commits] [libguestfs] 03/116: v2v: Add bounds check to Xml.xpathobj_node function.

Hilko Bengen bengen at moszumanska.debian.org
Wed Nov 26 22:04:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.

commit 1470be7f3b36b9ba6862fd04aa66446e89b108a7
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Oct 31 15:57:45 2014 +0000

    v2v: Add bounds check to Xml.xpathobj_node function.
    
    I accidentally called it with an out-of-bounds index, and it caused a
    core dump.  Add a bounds check to stop this from happening in
    production.
---
 v2v/xml-c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/v2v/xml-c.c b/v2v/xml-c.c
index f26e362..0b619e5 100644
--- a/v2v/xml-c.c
+++ b/v2v/xml-c.c
@@ -197,6 +197,9 @@ v2v_xml_xpathobj_get_node_ptr (value xpathobjv, value iv)
   xmlXPathObjectPtr xpathobj = Xpathobj_val (xpathobjv);
   int i = Int_val (iv);
 
+  if (i < 0 || i >= xpathobj->nodesetval->nodeNr)
+    caml_invalid_argument ("get_node_ptr: node number out of range");
+
   /* Because xmlNodePtrs are owned by the document, we don't want to
    * wrap this up with a finalizer, so just pass the pointer straight
    * back to OCaml as a value.  OCaml will ignore it because it's

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list