[Libreoffice-commits] core.git: sax/source
Caolán McNamara
caolanm at redhat.com
Sun Sep 17 19:38:49 UTC 2017
sax/source/expatwrap/xml2utf.cxx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 1ebf34c67142d1a36923ad6511301fb4b7458edd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 17 17:51:43 2017 +0100
protect against short file
Change-Id: I20c6a6fb34485f42c2a828618e8918d8a441860a
Reviewed-on: https://gerrit.libreoffice.org/42389
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 fde25ce8482b..58ee36c1c829 100644
--- a/sax/source/expatwrap/xml2utf.cxx
+++ b/sax/source/expatwrap/xml2utf.cxx
@@ -221,8 +221,7 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
}
// first level : detect possible file formats
- if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 5 ) ) {
-
+ if (seq.getLength() >= 5 && !strncmp(reinterpret_cast<const char *>(pSource), "<?xml", 5)) {
// scan for encoding
OString str( reinterpret_cast<const char *>(pSource), seq.getLength() );
More information about the Libreoffice-commits
mailing list