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] [rpc-light] Accept JSON string which contains UTF-XXX

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] [rpc-light] Accept JSON string which contains UTF-XXX characters.
From: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
Date: Thu, 10 Dec 2009 12:49:26 +0000
Delivery-date: Thu, 10 Dec 2009 04:49:24 -0800
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 Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
[rpc-light] Accept JSON string which contains UTF-XXX characters.

Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>

diff -r 33811c04f39c rpc-light/jsonrpc.ml
--- a/rpc-light/jsonrpc.ml      Fri Dec 04 17:09:54 2009 +0000
+++ b/rpc-light/jsonrpc.ml      Thu Dec 10 12:45:59 2009 +0000
@@ -154,10 +154,9 @@
                | _ -> false
 
        let is_valid_unescaped_char c =
-               match (Char.code c) with
-                       | 0x22 | 0x5c -> false
-                       | x when 0x20 <= x && x <= 0x7f -> true  (* only ASCII 
for now *)
-                       | _ -> false
+               match c with
+                       | '"' | '\\' | '\b' | '\x0c' | '\n' | '\r' | '\t' -> 
false
+                       | _ -> true
 
        let clist_to_string cs =
                let len = List.length cs in

Attachment: xapi-libs-accept-utfX-when-parsing-json
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] [rpc-light] Accept JSON string which contains UTF-XXX characters., Thomas Gazagnaire <=