From: Marcus Granado Date: Wed, 26 Jan 2011 17:39:05 +0000 (+0000) Subject: CA-46738: escape email body properly in vmpp alerts X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=aefdca183a4f3b20ba683defa40320137b539bac;p=xcp%2Fxen-api.git CA-46738: escape email body properly in vmpp alerts Signed-off-by: Marcus Granado --- 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