Skip to content

Commit 25dfb3a

Browse files
committed
tls: fix len check when parsing extensions
The first step to parse an extension is to read its type and size, which is a total of 4 bytes, not 2. Signed-off-by: Antoine Tenart <[email protected]>
1 parent e2c44ba commit 25dfb3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Tls {
4747
// Loop while we have potential valid extension headers.
4848
// https://www.rfc-editor.org/rfc/rfc8446#section-4.2
4949
let mut tls = Tls::default();
50-
while len >= 2 {
50+
while len >= 4 {
5151
// Extension type: u16
5252
// Vector size: u16
5353
let header = reader.read_as::<[u8; 4]>()?;

0 commit comments

Comments
 (0)