diff options
author | lloyd <[email protected]> | 2015-03-23 02:15:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-03-23 02:15:45 +0000 |
commit | 2d5669770a5723d258703384f905e1d13d6b8696 (patch) | |
tree | ec97fee38f319929833486caa168dc8dfffd6ca3 /src/lib | |
parent | e9283c9817949aa27ae97f0c9ec06745fb62240d (diff) |
Avoid putting very small values in mlock memory
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/alloc/locking_allocator/locking_allocator.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/alloc/locking_allocator/locking_allocator.cpp b/src/lib/alloc/locking_allocator/locking_allocator.cpp index 4a3dd3c4c..48aec5ce4 100644 --- a/src/lib/alloc/locking_allocator/locking_allocator.cpp +++ b/src/lib/alloc/locking_allocator/locking_allocator.cpp @@ -103,7 +103,9 @@ void* mlock_allocator::allocate(size_t num_elems, size_t elem_size) if(n / elem_size != num_elems) return nullptr; // overflow! - if(n > m_poolsize || n > BOTAN_MLOCK_ALLOCATOR_MAX_ALLOCATION) + if(n > m_poolsize) + return nullptr; + if(n < BOTAN_MLOCK_ALLOCATOR_MIN_ALLOCATION || n > BOTAN_MLOCK_ALLOCATOR_MAX_ALLOCATION) return nullptr; std::lock_guard<std::mutex> lock(m_mutex); |