---
svtools/source/svrtf/parrtf.cxx | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index 0b722d8..0c60834 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -341,7 +341,27 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
ByteString aByteString;
while (1)
{
- aByteString.Append((char)GetHexValue());
+ char c = (char)GetHexValue();
+
+ if (c)
+ {
+ aByteString.Append(c);
+ }
+ else
+ {
+ /* \'00 is a valid internal character in a
+ * string in RTF, however ByteString::Append
+ * does nothing if '\0' is passed in. It is
+ * otherwise capable of handling strings with
+ * embedded NULs, so add a '\1' and then
+ * change it, as ByteString::SetChar does not
+ * care if the character is '\0'.
+ */
+ int nLen = aByteString.Len();
+
+ aByteString.Append('\001');
+ aByteString.SetChar(nLen, '\0');
+ }
bool bBreak = false;
sal_Char nSlash = '\\';
--
1.7.2.5
Context
- [Libreoffice] [PATCH] Preserve RTF \'00 sequences (NUL) in strings · Troy Rollo
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.