소스 검색

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

Manish Goregaokar 9 년 전
부모
커밋
c5dbeb53c9
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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)