Kaydet (Commit) 2867c32c authored tarafından Caolán McNamara's avatar Caolán McNamara

keep track of available data

Change-Id: Idc54cdef0f3a4355a7e26f25cdc5b50d65d9d583
Reviewed-on: https://gerrit.libreoffice.org/45353Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst f3c4dd74
...@@ -36,6 +36,8 @@ public: ...@@ -36,6 +36,8 @@ public:
} }
const sal_Int8 * getCurrentPos () { return mpBuffer + mnCurrent; } const sal_Int8 * getCurrentPos () { return mpBuffer + mnCurrent; }
sal_Int32 remainingSize() const { return mnEnd - mnCurrent; }
// XInputStream chained // XInputStream chained
/// @throws css::io::NotConnectedException /// @throws css::io::NotConnectedException
......
...@@ -934,6 +934,9 @@ sal_Int32 ZipFile::readCEN() ...@@ -934,6 +934,9 @@ sal_Int32 ZipFile::readCEN()
if ( aEntry.nExtraLen < 0 ) if ( aEntry.nExtraLen < 0 )
throw ZipException("unexpected extra header info length" ); throw ZipException("unexpected extra header info length" );
if (aEntry.nPathLen > aMemGrabber.remainingSize())
throw ZipException("name too long");
// read always in UTF8, some tools seem not to set UTF8 bit // read always in UTF8, some tools seem not to set UTF8 bit
aEntry.sPath = OUString::intern ( reinterpret_cast<char const *>(aMemGrabber.getCurrentPos()), aEntry.sPath = OUString::intern ( reinterpret_cast<char const *>(aMemGrabber.getCurrentPos()),
aEntry.nPathLen, aEntry.nPathLen,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment