From 388bedaf7498c49b329b7476c1d2d3d7175228fe Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Wed, 5 Apr 2017 10:28:24 +0200
Subject: [PATCH] [KOE-96] Added XML escaping to OOF messages.
---
.../AcaciaZPushPlugin/Utils/ActiveSync.cs | 2 +-
.../AcaciaZPushPlugin/Utils/StringUtil.cs | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/ActiveSync.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/ActiveSync.cs
index 69934f4..c39eda6 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/ActiveSync.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/ActiveSync.cs
@@ -206,7 +206,7 @@ namespace Acacia.Utils
s.Append("1");
s.Append("Text");
s.Append("");
- s.Append(_value.Message[i].Message); // TODO: escaping
+ s.Append(_value.Message[i].Message.EncodeXML());
s.Append("");
}
}
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/StringUtil.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/StringUtil.cs
index 6d990c0..c71a730 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/StringUtil.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Utils/StringUtil.cs
@@ -76,6 +76,8 @@ namespace Acacia.Utils
#endregion
+ #region XML
+
public static string ToXMLString(this XmlNode xml)
{
using (var stringWriter = new StringWriter())
@@ -87,6 +89,13 @@ namespace Acacia.Utils
}
}
+ public static string EncodeXML(this string s)
+ {
+ return System.Security.SecurityElement.Escape(s);
+ }
+
+ #endregion
+
#region Resources