Skip to content

Commit

Permalink
Fixes #28.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jun 21, 2021
1 parent ec1b7d4 commit 5d086d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ impl<'a> AsciiStr<'a> {

#[inline]
pub fn check_len(&self, n: usize) -> bool {
unsafe { self.ptr.add(n) <= self.end }
let len = self.end as usize - self.ptr as usize;
n <= len
}

#[inline]
Expand Down

0 comments on commit 5d086d1

Please sign in to comment.