summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sot/source/sdstor/stgstrms.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 0feebb3107cf..d83ffff27399 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -913,8 +913,9 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
if ( n < 0 )
return 0;
- if( ( m_nPos + n ) > m_nSize )
- n = m_nSize - m_nPos;
+ const auto nAvailable = m_nSize - m_nPos;
+ if (n > nAvailable)
+ n = nAvailable;
sal_Int32 nDone = 0;
while( n )
{