Skip to content

Commit

Permalink
Fix In some cases, pkt_num_offset greater than left can cause a panic (
Browse files Browse the repository at this point in the history
  • Loading branch information
majiange committed Nov 15, 2024
1 parent d1057f7 commit f60afa8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,11 @@ impl Connection {
}

// Encode packet number
let len = packet::encode_packet_num(pkt_num, pkt_num_len, &mut out[pkt_num_offset..left])?;
let len = packet::encode_packet_num(
pkt_num,
pkt_num_len,
&mut out[pkt_num_offset..pkt_num_offset + pkt_num_len],
)?;
let payload_offset = pkt_num_offset + len;

// Write frames into the packet payload
Expand Down

0 comments on commit f60afa8

Please sign in to comment.