From a673e1913b34e98840dbfc51c6c969e4cc8add48 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 2 Aug 2024 10:42:56 +0200 Subject: [PATCH] ssh/frames: avoid unsigned integer overflow Fixes: 0b2ed97f3678 ("ssh: frames support") --- rust/src/ssh/ssh.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index 1d38a1bd50..a6a3871a8e 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -233,7 +233,8 @@ impl SSHState { flow, stream_slice, input, - (head.pkt_len + 4) as i64, + // cast first to avoid unsigned integer overflow + (head.pkt_len as u64 + 4) as i64, SshFrameType::RecordPdu as u8, Some(0), ); -- 2.47.2