[Libreoffice-commits] core.git: sax/source
Caolán McNamara
caolanm at redhat.com
Sun Sep 17 16:23:03 UTC 2017
sax/source/expatwrap/xml2utf.cxx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 4025422a536a732ee2f91158d2749cc2adbc5408
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 17 14:01:05 2017 +0100
ofz: string has to be at least 5 chars long
Change-Id: I98c50a59c03fc886d50362b9c5dd8c84f60e0b62
Reviewed-on: https://gerrit.libreoffice.org/42379
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx
index c12783f10cef..fde25ce8482b 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", 5 ) )
+ if (seq.getLength() >= 5 && !strncmp(reinterpret_cast<const char *>(pSource), "<?xml", 5))
{
// scan for encoding
@@ -160,7 +160,6 @@ void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq )
&( seq.getArray()[nStop+1]) ,
seq.getLength() - nStop -1);
seq.realloc( seq.getLength() - ( nStop+1 - nFound ) );
-// str = String( (char * ) seq.getArray() , seq.getLen() );
}
}
}
More information about the Libreoffice-commits
mailing list