diff options
Diffstat (limited to 'src/Common/BootEncryption.h')
-rw-r--r-- | src/Common/BootEncryption.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index c8c9e29f..06da2bba 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -82,6 +82,19 @@ namespace VeraCrypt ~Buffer () { delete[] DataPtr; } byte *Ptr () const { return DataPtr; } size_t Size () const { return DataSize; } + void Resize (size_t newSize) + { + if (newSize > DataSize) + { + byte *tmp = new byte[newSize]; + if (!tmp) + throw bad_alloc(); + memcpy (tmp, DataPtr, DataSize); + delete [] DataPtr; + DataPtr = tmp; + } + DataSize = newSize; + } protected: byte *DataPtr; |