We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dc9374f commit cc2b3f4Copy full SHA for cc2b3f4
src/lib.rs
@@ -746,7 +746,10 @@ impl Url {
746
pub fn password(&self) -> Option<&str> {
747
// This ':' is not the one marking a port number since a host can not be empty.
748
// (Except for file: URLs, which do not have port numbers.)
749
- if self.has_authority() && self.byte_at(self.username_end) == b':' {
+ if self.has_authority()
750
+ && self.username_end < self.serialization.len() as u32
751
+ && self.byte_at(self.username_end) == b':'
752
+ {
753
debug_assert!(self.byte_at(self.host_start - 1) == b'@');
754
Some(self.slice(self.username_end + 1..self.host_start - 1))
755
} else {
0 commit comments