From 7a72e093f4ef50087a7b3d89b335b4becb448d45 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 12 Sep 2020 20:44:57 -0400 Subject: [PATCH] tor_bytes::Reader: fix a bug in truncate. --- tor-bytes/src/reader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tor-bytes/src/reader.rs b/tor-bytes/src/reader.rs index a3839c7ab..4df78cc2a 100644 --- a/tor-bytes/src/reader.rs +++ b/tor-bytes/src/reader.rs @@ -108,7 +108,7 @@ impl<'a> Reader<'a> { /// Fewer than `n` bytes may remain if there were not enough bytes /// to begin with. pub fn truncate(&mut self, n: usize) { - self.b = &self.b[self.off..self.off + n]; + self.b = &self.b[..self.off + n]; } /// Try to return a slice of `n` bytes from this reader without /// consuming them.