summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-09-17 14:01:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-09-17 18:22:32 +0200
commit4025422a536a732ee2f91158d2749cc2adbc5408 (patch)
tree5e924f782b4395cd82cb876b26f0ede9779dbd99 /sax
parent64b7ff9f6ca03561d2d3db86d464545b282d4a3a (diff)
ofz: string has to be at least 5 chars long
Change-Id: I98c50a59c03fc886d50362b9c5dd8c84f60e0b62 Reviewed-on: https://gerrit.libreoffice.org/42379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sax')
-rw-r--r--sax/source/expatwrap/xml2utf.cxx3
1 files changed, 1 insertions, 2 deletions
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() );
}
}
}