From 959e1b409b01ffcf80ed091724fa51a54e97c3c7 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Tue, 18 Jul 2017 22:44:33 +0900 Subject: sax: Check if it starts with 5 bytes of " Reviewed-by: Noel Grandin (cherry picked from commit b64e564492220b34c14f069e8e1f42675bd9abe6) ofz: string has to be at least 5 chars long Reviewed-on: https://gerrit.libreoffice.org/42379 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara this should presumably be 5, rather than 4 Change-Id: Iec5b748b188c7b1bf61e8137faf4b3f2d480d7f1 98c50a59c03fc886d50362b9c5dd8c84f60e0b62 20c6a6fb34485f42c2a828618e8918d8a441860a Reviewed-on: https://gerrit.libreoffice.org/42396 Reviewed-by: Julien Nabet Reviewed-by: Michael Stahl Reviewed-by: Christian Lohmaier Tested-by: Christian Lohmaier --- sax/source/expatwrap/xml2utf.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx index 6ccecc684983..c37f7d3a0c8e 100644 --- a/sax/source/expatwrap/xml2utf.cxx +++ b/sax/source/expatwrap/xml2utf.cxx @@ -125,7 +125,7 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter() void XMLFile2UTFConverter::removeEncoding( Sequence &seq ) { const sal_Int8 *pSource = seq.getArray(); - if( ! strncmp( reinterpret_cast(pSource), "= 5 && !strncmp(reinterpret_cast(pSource), " &seq ) &( seq.getArray()[nStop+1]) , seq.getLength() - nStop -1); seq.realloc( seq.getLength() - ( nStop+1 - nFound ) ); -// str = String( (char * ) seq.getArray() , seq.getLen() ); } } } @@ -177,7 +176,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s return false; } - if( ! strncmp( reinterpret_cast(pSource), "(pSource), " &seq ) } // first level : detect possible file formats - if( ! strncmp( reinterpret_cast(pSource), "= 5 && !strncmp(reinterpret_cast(pSource), "(pSource), seq.getLength() ); -- cgit