Skip to content

Commit a1ee406

Browse files
committed
Fix off-by-one error in schannel's max_protocol_version
1 parent 41522da commit a1ee406

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/imp/schannel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static PROTOCOLS: &'static [Protocol] = &[
2222

2323
fn convert_protocols(min: Option<::Protocol>, max: Option<::Protocol>) -> &'static [Protocol] {
2424
let mut protocols = PROTOCOLS;
25-
if let Some(p) = max.and_then(|max| protocols.get(..max as usize)) {
25+
if let Some(p) = max.and_then(|max| protocols.get(..=max as usize)) {
2626
protocols = p;
2727
}
2828
if let Some(p) = min.and_then(|min| protocols.get(min as usize..)) {

src/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ fn server_no_shared_protocol() {
261261
let socket = p!(TcpStream::connect(("localhost", port)));
262262
let builder = p!(TlsConnector::builder()
263263
.add_root_certificate(root_ca)
264+
.min_protocol_version(Some(Protocol::Tlsv11))
264265
.max_protocol_version(Some(Protocol::Tlsv11))
265266
.build());
266267
assert!(builder.connect("localhost", socket).is_err());

0 commit comments

Comments
 (0)