diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-06-06 18:56:54 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@novell.com> | 2011-06-06 18:56:54 +0530 |
commit | 7d4ac53a460c8dd1387d19b547ce7899d78cf10d (patch) | |
tree | 66aff49a5a93d55b1f1df19d050118c9250532d3 /sc/source/filter/excel/xestream.cxx | |
parent | ac40e3aa5ca58367af33443fe6519756ff09266d (diff) |
Out-of-bounds array access fix. (Thanks to Fridrich too).
Diffstat (limited to 'sc/source/filter/excel/xestream.cxx')
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 331ae1303b94..fa7fbe462639 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -861,10 +861,10 @@ OUString XclXmlUtils::ToOUString( const char* s ) OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sal_Int32 nLength ) { - if( nLength == -1 ) - nLength = rBuf.size(); + if( nLength == -1 || ( nLength > (rBuf.size() - nStart) ) ) + nLength = (rBuf.size() - nStart); - return OUString( &rBuf[nStart], nLength ); + return (nLength > 0) ? OUString( &rBuf[nStart], nLength ) : OUString(); } OUString XclXmlUtils::ToOUString( const String& s ) |