Skip to content

Commit de0b1a1

Browse files
authored
Use &[u8]::get instead of &[u8] to avoid panic in basic auth (#220)
1 parent c914167 commit de0b1a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/common/authorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl Credentials for Basic {
156156
value,
157157
);
158158

159-
let bytes = &value.as_bytes()["Basic ".len()..];
159+
let bytes = value.as_bytes().get("Basic ".len()..)?;
160160
let non_space_pos = bytes.iter().position(|b| *b != b' ')?;
161161
let bytes = &bytes[non_space_pos..];
162162

0 commit comments

Comments
 (0)