From bdbbb6471c166c49ec61b5e6f0d987c07a5855a2 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 11 Feb 2025 12:06:55 +0200 Subject: [PATCH] Add test --- neqo-transport/src/shuffle.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/neqo-transport/src/shuffle.rs b/neqo-transport/src/shuffle.rs index fdea23f999..9d0295c391 100644 --- a/neqo-transport/src/shuffle.rs +++ b/neqo-transport/src/shuffle.rs @@ -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)