Skip to content

Commit d8054dc

Browse files
committed
d2i_SSL_SESSION: handle negative buffer lengths
1 parent 2b61a63 commit d8054dc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/entry.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,12 @@ entry! {
17591759
.into();
17601760
}
17611761

1762+
let Ok(length) = usize::try_from(length) else {
1763+
return Error::bad_data("d2i_SSL_SESSION with negative length")
1764+
.raise()
1765+
.into();
1766+
};
1767+
17621768
let ptr = unsafe { ptr::read(pp) };
17631769
let slice = try_slice!(ptr, length);
17641770

0 commit comments

Comments
 (0)