diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-06-06 18:56:54 +0530 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-07-19 14:45:28 +0200 |
commit | cf509b9aa79a3429caea80d933f7642397f8aab5 (patch) | |
tree | 355bffcbbdcb9a0bcd098115b9ba50748acd88bf | |
parent | 966c5a3169e498c24488e505c0ff247bc0a6593a (diff) |
Out-of-bounds array access fix. (Thanks to Fridrich too).
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
-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 319dfe18d..5108c3c16 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 ) |