aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-09-09 12:34:08 -0400
committerJack Lloyd <[email protected]>2016-09-09 12:34:08 -0400
commit7dec665c4cbd63c27cb7d2d4d907daf13c3ff9bc (patch)
tree7f5c7b5a35f87314bb4fafb102b628253e90ba05 /src/lib/base
parentb17f5924b61b0fdc8fe6de809fffe33d2b19f04b (diff)
Prevent use of secure_vector with non-integer types
If a non trival type was used, memory corruption could occur. Original issue reported by Matthias Gierlings.
Diffstat (limited to 'src/lib/base')
-rw-r--r--src/lib/base/secmem.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/base/secmem.h b/src/lib/base/secmem.h
index 01024a104..ff76e9429 100644
--- a/src/lib/base/secmem.h
+++ b/src/lib/base/secmem.h
@@ -12,6 +12,7 @@
#include <algorithm>
#include <vector>
#include <deque>
+#include <type_traits>
#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
#include <botan/locking_allocator.h>
@@ -23,6 +24,8 @@ template<typename T>
class secure_allocator
{
public:
+ static_assert(std::is_integral<T>::value, "secure_allocator supports only integer types");
+
typedef T value_type;
typedef T* pointer;