We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17f3d20 commit c5f6a97Copy full SHA for c5f6a97
src/lib.rs
@@ -752,7 +752,10 @@ impl Url {
752
pub fn password(&self) -> Option<&str> {
753
// This ':' is not the one marking a port number since a host can not be empty.
754
// (Except for file: URLs, which do not have port numbers.)
755
- if self.has_authority() && self.byte_at(self.username_end) == b':' {
+ if self.has_authority()
756
+ && self.username_end < self.serialization.len() as u32
757
+ && self.byte_at(self.username_end) == b':'
758
+ {
759
debug_assert!(self.byte_at(self.host_start - 1) == b'@');
760
Some(self.slice(self.username_end + 1..self.host_start - 1))
761
} else {
0 commit comments