Skip to content

Commit 2a394b4

Browse files
authored
Merge pull request #204 from blyxxyz/schannel-max-protocol-off-by-one
Fix off-by-one error in schannel's max_protocol_version
2 parents 41522da + 38b1796 commit 2a394b4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,5 @@ jobs:
5353
with:
5454
path: target
5555
key: target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
56-
- run: cargo test
57-
- run: cargo test --features alpn
5856
- run: cargo test --features vendored
57+
- run: cargo test --features vendored,alpn

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)