Skip to content

Commit cab88e7

Browse files
committed
Do not accept timestamps from the future
1 parent 2f93ea9 commit cab88e7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mimeparser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::param::{Param, Params};
3535
use crate::peerstate::Peerstate;
3636
use crate::simplify::{simplify, SimplifiedText};
3737
use crate::sync::SyncItems;
38+
use crate::tools::time;
3839
use crate::tools::{
3940
get_filemeta, parse_receive_headers, smeared_time, truncate_msg_text, validate_id,
4041
};
@@ -1864,10 +1865,12 @@ impl MimeMessage {
18641865
///
18651866
/// Returns `None` if there is no such header.
18661867
pub async fn chat_group_member_timestamps(&self) -> Option<Vec<i64>> {
1868+
let now = time() + constants::TIMESTAMP_SENT_TOLERANCE;
18671869
self.get_header(HeaderDef::ChatGroupMemberTimestamps)
18681870
.map(|h| {
18691871
h.split_ascii_whitespace()
18701872
.filter_map(|ts| ts.parse::<i64>().ok())
1873+
.map(|ts| std::cmp::min(now, ts))
18711874
.collect()
18721875
})
18731876
}

0 commit comments

Comments
 (0)