From efa436974d8203485eec6faa1bf0116bb32f6fcd Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 30 Nov 2015 11:35:41 +0100 Subject: Linux/MacOSX: Implement Unicode passwords suppport. Make validation of parameters in GUI more robust. --- src/Platform/Buffer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Platform') 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 () -- cgit v1.2.3