s2s/xline: reject a malformed ADDLINE duration instead of coercing it to 0 (= a silent permanent ban), and make add_xline expiry saturating (n.saturating_add) so a peer sending duration=u64::MAX can't overflow-panic the debug build or wrap in release

This commit is contained in:
Jean Chevronnet 2026-08-19 00:39:40 +00:00
parent bbe4ee4567
commit 11cec9fc36
2 changed files with 7 additions and 2 deletions

View file

@ -259,7 +259,7 @@ impl Server {
mask: mask.to_string(),
reason: reason.to_string(),
setter: setter.to_string(),
expires: if duration == 0 { 0 } else { n + duration },
expires: if duration == 0 { 0 } else { n.saturating_add(duration) },
});
self.snotice_c('x', &format!(
"{setter} added a {}-line on {mask}: {reason}",