Procházet zdrojové kódy

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

Manish Goregaokar před 9 roky
rodič
revize
c5dbeb53c9
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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)