]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
[rpc-light] Accept JSON string which contains UTF-XXX characters.
authorThomas Gazagnaire <thomas.gazagnaire@citrix.com>
Fri, 11 Dec 2009 12:03:12 +0000 (12:03 +0000)
committerThomas Gazagnaire <thomas.gazagnaire@citrix.com>
Fri, 11 Dec 2009 12:03:12 +0000 (12:03 +0000)
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@citrix.com>
rpc-light/jsonrpc.ml

index aa9c91a5527fdb663b0386e606e75b04946619e2..08bcd2ec86637ef3cbf6af12934e70558ee99694 100644 (file)
@@ -154,10 +154,9 @@ module Parser = struct
                | _ -> 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