From e74718706e8a51ba2d07ba0dc291182d6b5147da Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 4 Nov 2024 01:20:26 +0000 Subject: [PATCH] ConnId: Fix hax complaints --- shared/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 99db64bb..eefa32cf 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -254,8 +254,13 @@ impl ConnId { } } s[0] = input.len() as u8 | 0x40; - s.get_mut(1..1 + input.len())?.copy_from_slice(input); - Some(Self(s)) + if let Some(tail) = s.get_mut(1..1 + input.len()) { + tail.copy_from_slice(input); + Some(Self(s)) + } else { + // Data too long + None + } } }