summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstrongswan/credentials/sets/cert_cache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstrongswan/credentials/sets/cert_cache.c b/src/libstrongswan/credentials/sets/cert_cache.c
index f1579c60a..ceebb3843 100644
--- a/src/libstrongswan/credentials/sets/cert_cache.c
+++ b/src/libstrongswan/credentials/sets/cert_cache.c
@@ -151,7 +151,7 @@ static void cache(private_cert_cache_t *this,
for (try = 0; try < REPLACE_TRIES; try++)
{
/* replace a random relation */
- offset = random();
+ offset = random() % CACHE_SIZE;
for (i = 0; i < CACHE_SIZE; i++)
{
rel = &this->relations[(i + offset) % CACHE_SIZE];