diff options
author | Troy Rollo <libreoffice@troy.rollo.name> | 2011-07-19 14:47:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-07-19 14:47:02 +0100 |
commit | 8e2abdc5151a4bcef63f9138f2c35837af36ffe4 (patch) | |
tree | f8e34713e2424348c4dce03afb00e1c562028409 /svtools | |
parent | 21cd1cd2c640aa923e6ee39acf0325c7e84487d6 (diff) |
Preserve RTF \'00 sequences (NULL) in strings
Diffstat (limited to 'svtools')
-rw-r--r-- | 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 a475343dcaac..5a04328045c6 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 = '\\'; |