summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@novell.com>2011-06-06 18:56:54 +0530
committerDavid Tardon <dtardon@redhat.com>2011-07-19 15:08:20 +0200
commit0ba39ceb58a3e14f0a60dd5331cf1dca5e3ceada (patch)
treee08a67246e04e693932eee73126a5bdb70c2d44b /sc
parent1487ce801b43c6bf152e2ee8aa4339336904c359 (diff)
Out-of-bounds array access fix. (Thanks to Fridrich too).
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch> Signed-off-by: Michael Meeks <michael.meeks@novell.com> Signed-off-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xestream.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index d6d729ce1de2..4e2798e06ee9 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 )