WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] CA-40329: Fix the bound checks in the Ipq.find* functions.
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-40329: Fix the bound checks in the Ipq.find* functions., Rob Hoes <=