summaryrefslogtreecommitdiff
path: root/package/source/zipapi/ZipFile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'package/source/zipapi/ZipFile.cxx')
-rw-r--r--package/source/zipapi/ZipFile.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 3f40df8a0a5f..b855859d4610 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -821,11 +821,14 @@ sal_Int32 ZipFile::findEND( )
nEnd = nPos >= 0 ? nPos : 0 ;
aGrabber.seek( nEnd );
- aGrabber.readBytes ( aBuffer, nLength - nEnd );
+
+ auto nSize = nLength - nEnd;
+ if (nSize != aGrabber.readBytes(aBuffer, nSize))
+ throw ZipException("Zip END signature not found!" );
const sal_Int8 *pBuffer = aBuffer.getConstArray();
- nPos = nLength - nEnd - ENDHDR;
+ nPos = nSize - ENDHDR;
while ( nPos >= 0 )
{
if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 5 && pBuffer[nPos+3] == 6 )