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 b991fa8 commit fe01a88Copy full SHA for fe01a88
src/lib.rs
@@ -747,7 +747,10 @@ impl Url {
747
pub fn password(&self) -> Option<&str> {
748
// This ':' is not the one marking a port number since a host can not be empty.
749
// (Except for file: URLs, which do not have port numbers.)
750
- if self.has_authority() && self.byte_at(self.username_end) == b':' {
+ if self.has_authority()
751
+ && self.username_end < self.serialization.len() as u32
752
+ && self.byte_at(self.username_end) == b':'
753
+ {
754
debug_assert!(self.byte_at(self.host_start - 1) == b'@');
755
Some(self.slice(self.username_end + 1..self.host_start - 1))
756
} else {
0 commit comments