Skip to content

Commit 7e9613c

Browse files
committed
mitm: fix a panic in pkt_modify_hook(), similar as in 0b51e4d
1 parent a80d8f8 commit 7e9613c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/mitm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ pub async fn pkt_modify_hook(
266266
video_in_motion: bool,
267267
ctx: &mut ModifyContext,
268268
) -> Result<()> {
269+
// if for some reason we have too small packet, bail out
270+
if pkt.payload.len() < 2 {
271+
return Ok(());
272+
}
273+
269274
// message_id is the first 2 bytes of payload
270275
let message_id: i32 = u16::from_be_bytes(pkt.payload[0..=1].try_into()?).into();
271276
let data = &pkt.payload[2..]; // start of message data

0 commit comments

Comments
 (0)