From aefdca183a4f3b20ba683defa40320137b539bac Mon Sep 17 00:00:00 2001 From: Marcus Granado Date: Wed, 26 Jan 2011 17:39:05 +0000 Subject: [PATCH] CA-46738: escape email body properly in vmpp alerts Signed-off-by: Marcus Granado --- ocaml/xapi/xapi_vmpp.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ocaml/xapi/xapi_vmpp.ml b/ocaml/xapi/xapi_vmpp.ml index 1d71ba48..9ce99dde 100644 --- a/ocaml/xapi/xapi_vmpp.ml +++ b/ocaml/xapi/xapi_vmpp.ml @@ -61,7 +61,13 @@ let create_alert ~__context ~vmpp ~name ~priority ~body ~data = assert_licensed ~__context; let value = data in let msg = - ""^body^""^value^"" + (* value is expected to be valid xml data, + whereas body is not expected to be a valid xml string + *) + "" + (* escape any invalid xml string *) + ^(Xml.to_string (Xml.PCData body)) + ^""^value^"" in let successful = priority < 5L in if successful -- 2.39.5