Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Feb 11, 2025
1 parent a6a5a76 commit bdbbb64
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions neqo-transport/src/shuffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ mod tests {
assert!(super::find_sni(truncated).is_none());
}

#[test]
fn find_sni_invalid_sni_length() {
// ClientHello with an SNI extension with an invalid length
let mut buf = Vec::from(BUF_WITH_SNI);
let len = buf.len();

assert!(buf[len - 23] == 0x00 && buf[len - 22] == 0x0c); // Check Server Name List length
// Set Server Name List length to 0
buf[len - 23] = 0x00;
buf[len - 22] = 0x00;
assert!(super::find_sni(&buf).is_none());
}

#[test]
fn find_sni_no_ci() {
// Not a ClientHello (msg_type != 1)
Expand Down

0 comments on commit bdbbb64

Please sign in to comment.