Parcourir la source

Don't go out of bounds when slicing (fixes #241)

Manish Goregaokar il y a 9 ans
Parent
commit
c5dbeb53c9
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/lib.rs

+ 1 - 1
src/lib.rs

@@ -498,7 +498,7 @@ impl Url {
     /// as is typically the case of `data:` and `mailto:` URLs.
     #[inline]
     pub fn cannot_be_a_base(&self) -> bool {
-        self.byte_at(self.path_start) != b'/'
+        !self.slice(self.path_start..).starts_with('/')
     }
 
     /// Return the username for this URL (typically the empty string)