diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-07-18 22:44:33 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-20 15:52:43 +0200 |
commit | b64e564492220b34c14f069e8e1f42675bd9abe6 (patch) | |
tree | b32dbce9c5f841d0593045407bd30d45881e87ac /sax/source | |
parent | 85eac9b404f7db255501f19ebbd56c75c4260613 (diff) |
sax: Check if it starts with 5 bytes of "<?xml"
Change-Id: Iec5b748b188c7b1bf61e8137faf4b3f2d480d7f1
Reviewed-on: https://gerrit.libreoffice.org/40139
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax/source')
-rw-r--r-- | sax/source/expatwrap/xml2utf.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 18540c0ce1af..c12783f10cef 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -125,7 +125,7 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter() void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq ) { const sal_Int8 *pSource = seq.getArray(); - if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4) ) + if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) { // scan for encoding @@ -177,7 +177,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s return false; } - if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) { + if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) { // scan if the <?xml tag finishes within this buffer bCheckIfFirstClosingBracketExsists = true; } @@ -222,7 +222,7 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq ) } // first level : detect possible file formats - if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) { + if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) { // scan for encoding OString str( reinterpret_cast<const char *>(pSource), seq.getLength() ); |