[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] CA-40329: Fix the bound checks in the Ipq.find* functions.


  • To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
  • From: Rob Hoes <rob.hoes@xxxxxxxxxx>
  • Date: Wed, 14 Apr 2010 14:39:41 +0100
  • Delivery-date: Wed, 14 Apr 2010 06:40:09 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
CA-40329: Fix the bound checks in the Ipq.find* functions.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r 256e76148ba4 ocaml/xapi/ipq.ml
--- a/ocaml/xapi/ipq.ml Mon Apr 12 20:32:36 2010 +0100
+++ b/ocaml/xapi/ipq.ml Wed Apr 14 14:34:43 2010 +0100
@@ -87,17 +87,15 @@
 
 let find h ev =
   let rec iter n =
-    match n with
-      -1 -> -1
-    | m -> if ev = h.data.(n).ev then n else iter (n-1)
+    if n < 0 then -1
+    else if ev = h.data.(n).ev then n else iter (n-1)
   in
   iter (h.size-1)
   
 let find_p h f =
   let rec iter n =
-    match n with
-      -1 -> -1
-    | m -> if f h.data.(n).ev then n else iter (n-1)
+    if n < 0 then -1
+    else if f h.data.(n).ev then n else iter (n-1)
   in
   iter (h.size-1)
   

Attachment: ipq-bounds
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.