Skip to content

Commit

Permalink
Fix an issue where enabling HTTP debugging may attempt to slice a str…
Browse files Browse the repository at this point in the history
…ing across a character boundry resulting in a panic
  • Loading branch information
arlosi committed Aug 9, 2023
1 parent 2b3554f commit 13f1da9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cargo/util/network/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ pub fn configure_http_handle(config: &Config, handle: &mut Easy) -> CargoResult<
_ => return,
};
let starts_with_ignore_case = |line: &str, text: &str| -> bool {
let line = line.as_bytes();
let text = text.as_bytes();
line[..line.len().min(text.len())].eq_ignore_ascii_case(text)
};
match str::from_utf8(data) {
Expand Down

0 comments on commit 13f1da9

Please sign in to comment.