diff options
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/Buffer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Platform/Buffer.cpp b/src/Platform/Buffer.cpp index 6fd8a01a..f0b7b693 100644 --- a/src/Platform/Buffer.cpp +++ b/src/Platform/Buffer.cpp @@ -58,11 +58,15 @@ namespace VeraCrypt void Buffer::CopyFrom (const ConstBufferPtr &bufferPtr)
{
if (!IsAllocated ())
- Allocate (bufferPtr.Size());
+ {
+ if (bufferPtr.Size())
+ Allocate (bufferPtr.Size());
+ }
else if (bufferPtr.Size() > DataSize)
throw ParameterTooLarge (SRC_POS);
- Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size());
+ if (bufferPtr.Size())
+ Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size());
}
void Buffer::Erase ()
|