Vec::advance_mut can advance past the end of the buffer (#108)

This commit is contained in:
Dan Burkert
2017-04-30 16:14:54 -07:00
committed by Carl Lerche
parent 923d927bd1
commit 30bd7c1f21
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -713,7 +713,7 @@ impl BufMut for Vec<u8> {
if cnt > remaining {
// Reserve additional capacity, and ensure that the total length
// will not overflow usize.
self.reserve(cnt - remaining);
self.reserve(cnt);
}
self.set_len(len + cnt);