From 4af9b74776206e8bbca1a02b3e2f868752e13c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 18 Jan 2021 20:46:34 +0100 Subject: [PATCH] crypto: Properly clamp the rotation period of the outbound session --- matrix_sdk_crypto/src/olm/group_sessions/outbound.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix_sdk_crypto/src/olm/group_sessions/outbound.rs b/matrix_sdk_crypto/src/olm/group_sessions/outbound.rs index e467c703..4f82c93d 100644 --- a/matrix_sdk_crypto/src/olm/group_sessions/outbound.rs +++ b/matrix_sdk_crypto/src/olm/group_sessions/outbound.rs @@ -22,7 +22,7 @@ use matrix_sdk_common::{ uuid::Uuid, }; use std::{ - cmp::min, + cmp::max, fmt, sync::{ atomic::{AtomicBool, AtomicU64, Ordering}, @@ -279,9 +279,9 @@ impl OutboundGroupSession { count >= self.settings.rotation_period_msgs || self.creation_time.elapsed() // Since the encryption settings are provided by users and not - // checked someone could set a really low rotation perdiod so + // checked someone could set a really low rotation period so // clamp it at a minute. - >= min(self.settings.rotation_period, Duration::from_secs(3600)) + >= max(self.settings.rotation_period, Duration::from_secs(3600)) } /// Has the session been invalidated.