Skip to content

Commit

Permalink
Merge pull request #739 from OlegTsyba/fix_grow_zerofill
Browse files Browse the repository at this point in the history
fix(buffer): prevent possible buffer overflow in `grow_zerofill`
  • Loading branch information
seanmonstar committed Mar 2, 2016
2 parents 63b2759 + c720295 commit 45ec6fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ unsafe fn grow_zerofill(buf: &mut Vec<u8>, additional: usize) {
use std::ptr;
let len = buf.len();
buf.set_len(len + additional);
ptr::write_bytes(buf.as_mut_ptr().offset(len as isize), 0, buf.len());
ptr::write_bytes(buf.as_mut_ptr().offset(len as isize), 0, additional);
}

impl<R: Read> Read for BufReader<R> {
Expand Down

0 comments on commit 45ec6fd

Please sign in to comment.